×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Regular Contributor
    Join Date
    Jul 2004
    Posts
    201

    how to get the sms originator's name

    hi

    I have seen that CSmsHeader::FromAddress() can get
    the originator address.
    But address is their's phone number,
    if I want to get the sms sender's name,
    How to get it.

    pl tell me.

    Thank you very much.


    Waiting for your reply.

  2. #2
    Registered User
    Join Date
    Feb 2006
    Posts
    24

    Re: how to get the sms originator's name

    The sender's name isn't sent with an SMS. The best you can do is see if you can match the originating phone number to a name in the recipients addressbook.

  3. #3
    Regular Contributor
    Join Date
    Jul 2004
    Posts
    201

    Re: how to get the sms originator's name

    how to match the originating phone number to a name in the recipients addressbook.
    please give me a sample code.
    Thank you .

  4. #4
    Registered User
    Join Date
    Feb 2006
    Posts
    24

    Re: how to get the sms originator's name

    Look up the CContactDatabase class in the SDK and online, there are plenty of resources for it... The FindLC function will probably be useful.

    The general process would be:
    - Open the contact database
    - FindLC the number in the KUidContactFieldPhoneNumber field
    - If there is a match, open the contact and read their KUidContactFieldGivenName + KUidContactFieldFamilyName fields to get their name

  5. #5
    Regular Contributor
    Join Date
    Jul 2004
    Posts
    201

    Re: how to get the sms originator's name

    Thank you.
    I will try it.

  6. #6
    Registered User
    Join Date
    Jan 2006
    Posts
    15

    Re: how to get the sms originator's name

    TBool PhonebookClient::FindContactName(TDesC& aPhoneSender, TDes& aNameSender)
    {
    /*
    * Open Database
    */
    CContactDatabase* iContactsData = CContactDatabase::OpenL();
    CleanupStack::PushL(iContactsData);

    /*
    * The MatchPhoneNumber search one PhoneNumber
    */
    CContactIdArray *iSearchContactArray = iContactsData->MatchPhoneNumberL(aPhoneSender, KPhonebookSenderPhoneLength);
    TContactItemId iContactId;

    /*
    * If result, return first
    */
    if (iSearchContactArray->Count() > 0)
    {
    iContactId = (*iSearchContactArray)[0];

    /*
    * Extract name on DataBase
    */
    iContactsData->ReadContactTextDefL(iContactId, aNameSender, iNameTextDef);

    delete iSearchContactArray;
    CleanupStack::PopAndDestroy();
    return ETrue;
    }
    else
    {
    delete iSearchContactArray;
    CleanupStack::PopAndDestroy();

    /*
    * Si no encontro nada devuelve "" y Falso
    */
    aNameSender = _L("");
    return EFalse;
    }
    }

  7. #7
    Registered User
    Join Date
    Jan 2006
    Posts
    15

    Re: how to get the sms originator's name

    amm and

    iNameTextDef is equal to

    iNameTextDef = CContactTextDef::NewL();
    iNameTextDef->AppendL(TContactTextDefItem(KUidContactFieldGivenName, _L(" ")));
    iNameTextDef->AppendL(TContactTextDefItem(KUidContactFieldFamilyName));

    :-) Bye

  8. #8
    Regular Contributor
    Join Date
    Jul 2004
    Posts
    201

    Re: how to get the sms originator's name

    thank you very much

    I will try it.

  9. #9
    Super Contributor
    Join Date
    May 2005
    Location
    Hyderabad,India
    Posts
    704

    Re: how to get the sms originator's name

    Hi,

    U just go through PhoneBookEx and LookUp examples. These two examples are good for using contacts database.

    Lookup example
    http://www.symbian.com/developer/dow...pp.html#lookup


    regards,
    eswar

Similar Threads

  1. Read SMS/ SMS Alert.
    By nirenj in forum General Messaging
    Replies: 3
    Last Post: 2009-01-14, 12:39
  2. Replies: 2
    Last Post: 2007-11-10, 13:19
  3. Replies: 1
    Last Post: 2005-12-01, 23:57
  4. Error sending SMS
    By jorge_c in forum Multimodecards
    Replies: 0
    Last Post: 2003-10-07, 11:53
  5. Replies: 1
    Last Post: 2002-07-22, 11:08

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×