×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Regular Contributor
    Join Date
    Apr 2004
    Posts
    68

    Notify Of Incoming SMS

    Hello
    I want to know how the Symbian OS notify when some new SMS arrive on the phone.i wnat to know implement this feature in my application how can do this.If yes then how..

    Regards
    Anupam

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,167
    check GDSMS example, it has code that implements this functionality as well.

    yucca

  3. #3
    Regular Contributor
    Join Date
    May 2004
    Location
    NRW/ Germany
    Posts
    188
    Hi,

    I'm using part of the GDSMS code for notification of incoming and outgoing SMS. The problem is that it also recognize MMS. Is there a workaround just to monitor sms?

    Arne

  4. #4
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,167
    just improve the logic to check the message type and take the action only if the message is really SMS.

    yucca

  5. #5
    Regular Contributor
    Join Date
    May 2004
    Location
    NRW/ Germany
    Posts
    188
    I've done it. Thanks for your support yucca!

  6. #6
    Registered User
    Join Date
    Mar 2003
    Posts
    28
    Hi there,

    Can you send me the sms example? I cannot find it at forum.nokia or in the 9200 SDK.

    BR,
    Sami

  7. #7
    Regular Contributor
    Join Date
    May 2004
    Location
    NRW/ Germany
    Posts
    188
    I'm not sure, but I think this is the right one:

    http://www.forum.nokia.com/main/1,6566,21,00.html

    BR

    Arne

  8. #8
    Regular Contributor
    Join Date
    Oct 2004
    Location
    Tokyo,Japan
    Posts
    289
    I have developed an application to monitor for incoming SMS and it reads the current incomig SMS.

    I am putting the code for it.


    You need to create a subclass of MMsvSessionObserver
    class sub_class_name : public CActive, public MMsvSessionObserver

    which contains variable

    CMsvSession* iSession;
    CMsvEntry *iMsvEntry;
    TMsvId iNewMessageId;

    which include header files

    #include <msvapi.h> // MMsvSessionObserver
    #include<msvids.h>
    #include<msvapi.h>

    and in constructor of class

    void sub_class_name ::ConstructL()
    {
    CActiveScheduler::Add(this);
    // Create CMsvSession asynchronously
    iSession = CMsvSession::OpenAsyncL(*this);
    }

    and you get notifications of session events like incoming messges in method
    handlesessioneventL() in which you read the incoming SMS and that methos has to be implemented when using MMsvSessionObserver class :

    void sub_class_name ::HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3)
    {
    switch (aEvent)
    {

    case EMsvEntriesCreated:
    // notifies changes in the Inbox
    if (*(static_cast<TMsvId*>(aArg2)) == KMsvGlobalInBoxIndexEntryId)
    {
    CMsvEntrySelection* entries = static_cast<CMsvEntrySelection*>(aArg1);
    iNewMessageId = entries->At(0);
    }
    break;

    case EMsvEntriesChanged:

    //reading the SMS here into a rich text object , after its entry has been finally created
    if (*(static_cast<TMsvId*>(aArg2)) == KMsvGlobalInBoxIndexEntryId)
    {
    CMsvEntrySelection* entries = static_cast<CMsvEntrySelection*>(aArg1);
    if (iNewMessageId == entries->At(0))
    {

    // Set entry context to the new message
    iMsvEntry->SetEntryL(iNewMessageId);

    // Open the store, read-only
    CMsvStore* store = iMsvEntry->ReadStoreL();
    CleanupStack::PushL(store);

    // Get body text and send it to the container
    if (store->HasBodyTextL())
    {


    CParaFormatLayer* iParaFormatLayer = CParaFormatLayer::NewL();

    CharFormatLayer* iCharFormatLayer
    = CCharFormatLayer::NewL();
    CRichText* richText = CRichText::NewL(iParaFormatLayer,iCharFormatLayer);

    CleanupStack::PushL(richText);
    store->RestoreBodyTextL(*richText);
    const TInt length = richText->DocumentLength();
    //iAppContainer->SetTextL(richText->Read(0, length));

    TBuf<1000> textOfSMS;
    textOfSMS.Append(richText->Read(0, length));
    CleanupStack::PopAndDestroy(richText);

    // buffer variable textOfSMS contains text in the SMS

    }
    else
    {
    // no text in SMS
    }
    CleanupStack::PopAndDestroy(store);
    }
    }
    break;


    default:
    // do nothing
    break;
    }
    }

  9. #9
    Registered User
    Join Date
    Jun 2003
    Posts
    23

    Bio Message Parser problem

    yucca,
    please help me!!
    I have written an application to handle a BIO Message type... But I have some problems. My architecture is like the one proposed in BioExample example. I have a parser class (derived from CBaseScriptParser that is actived when the specific sms arrives.) and an external application launched automatically when the specific sms arrives..... The APPUI of this one derives from MMsvSessionObserver and I re-implemented the virtual function HandleSessionEventL() This function is called one time, after I callCMsvSession::OpenAsyncL(*this)... Besides, at the end, message box on the cellular phone doesn't respond... Even if my parser is correctly destroyed, this message box has a strange behaviour,it doesn't respond to any command....Çoul help me to understand what it's wrong my code? Thanks in advance. Lia

Posting Permissions

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