×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 22
  1. #1
    Regular Contributor
    Join Date
    Feb 2007
    Location
    Indonesia
    Posts
    95

    How to turn off the vibrate and sound notification for incoming message ?

    Hallo all,

    I am creating my own sms application and I want to turn off the vibrate or sound notification when the message is arrive. At default, the vibrate or sound notification depend on the phone profile, if I set it to silent, then it will vibrate, if I set it to general, it will play the sound.
    What I want to achieve is turn off that vibrate or sound notification no matter what the profile is, so the owner of the phone will not notified about the received message and my application can achieve and process the message silently.
    Right know I can achieve and process the message, but the notification is still active.
    Is it possible to do this?

    Thank you for any info about this.
    Thank You so much for your attention !

  2. #2
    Registered User
    Join Date
    Feb 2007
    Location
    India
    Posts
    1,128

    Re: How to turn off the vibrate and sound notification for incoming message ?

    Quote Originally Posted by ronaldwh
    Hallo all,

    I am creating my own sms application and I want to turn off the vibrate or sound notification when the message is arrive. At default, the vibrate or sound notification depend on the phone profile, if I set it to silent, then it will vibrate, if I set it to general, it will play the sound.
    What I want to achieve is turn off that vibrate or sound notification no matter what the profile is, so the owner of the phone will not notified about the received message and my application can achieve and process the message silently.
    .
    Hi ronaldwh,

    Through mtm u can do this task...

    Using HandleSessionEventL function for get incoming sms notification..
    When, you got incoming sms notification, after that..

    change or set incoming sms entry.....

    TMsvEntry entry(iMsvEntry->Entry());
    if(entry.Unread())
    {
    entry.SetInPreparation(EFalse);
    entry.SetUnread(EFalse);
    iMsvEntry->ChangeL(entry);
    }

    through this way you can receive message silently without vibration...
    Hope it'll help you....

  3. #3
    Regular Contributor
    Join Date
    Feb 2007
    Location
    Indonesia
    Posts
    95

    Re: How to turn off the vibrate and sound notification for incoming message ?

    Hallo kis_spn!

    I have tried your method and it worked flawlessly !
    Thank You very much !
    Thank You so much for your attention !

  4. #4
    Registered User
    Join Date
    Mar 2007
    Location
    India
    Posts
    13

    Re: How to turn off the vibrate and sound notification for incoming message ?

    hi i have used code given by you.....
    but i am not able to turn off vibrating the mobile phone.....
    i have written that code in HandleSessionEventL method in the "EMsvEntriesChanged" event.
    if i have to write this code in another event....?

    thanx for your help....

  5. #5
    Regular Contributor
    Join Date
    Feb 2007
    Location
    Indonesia
    Posts
    95

    Re: How to turn off the vibrate and sound notification for incoming message ?

    I think you should use the 'EMsvEntriesCreated' and check only message that created in Inbox. It enable you to process the incoming message and set it using
    Code:
    entry.SetInPreparation(EFalse);
    entry.SetUnread(EFalse);
    iMsvEntry->ChangeL(entry);
    Thank You so much for your attention !

  6. #6
    Registered User
    Join Date
    Feb 2007
    Location
    India
    Posts
    1,128

    Re: How to turn off the vibrate and sound notification for incoming message ?

    Quote Originally Posted by vimal r jain
    hi i have used code given by you.....
    but i am not able to turn off vibrating the mobile phone.....
    i have written that code in HandleSessionEventL method in the "EMsvEntriesChanged" event.
    if i have to write this code in another event....?

    thanx for your help....
    Hi vimal r jain,

    If you dont mind, Can you show me your code?
    after that I can understand you problem, But These thing working fine for me.
    So feel free write down...

  7. #7
    Registered User
    Join Date
    Mar 2007
    Location
    India
    Posts
    13

    Re: How to turn off the vibrate and sound notification for incoming message ?

    void CSmsEngine::HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1,
    TAny* aArg2, TAny* /*aArg3*/)
    {
    switch (aEvent)
    {
    case EMsvServerReady:
    // Initialise iMsvEntry
    if (!iMsvEntry)
    {
    iMsvEntry = CMsvEntry::NewL(*iMsvSession, KInbox,
    TMsvSelectionOrdering());
    }
    break;

    case EMsvEntriesCreated:
    // Only look for changes in the Inbox
    if (aArg2 && *(static_cast<TMsvId*>(aArg2)) == KObservedFolderId)
    {
    CMsvEntrySelection* entries =
    static_cast<CMsvEntrySelection*>(aArg1);
    if( entries->Count() >= 1 )
    {
    iNewMessageId = entries->At(0);

    }
    else
    {
    Panic(ESmsEngineInternal);
    }
    }
    break;

    case EMsvEntriesChanged:
    //Look for changes. When using the emulator observed folder is
    //drafts, otherwise inbox.
    //Also a check for the iListeningForIncoming is made
    if (aArg2 && *(static_cast<TMsvId*>(aArg2)) == KObservedFolderId
    && iListeningForIncoming )
    {
    CMsvEntrySelection* entries =
    static_cast<CMsvEntrySelection*>(aArg1);

    if( entries->Count() < 1 )
    {
    Panic(ESmsEngineInternal);
    }
    else if (iNewMessageId == entries->At(0))
    {

    if( !iMsvEntry )
    {
    Panic(ESmsEngineNotInitialized);
    return;
    }

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

    // Check the type of the arrived message and that the
    // message is complete.
    // only SMS's are our consern.
    if ( iMsvEntry->Entry().iMtm != KUidMsgTypeSMS ||
    !iMsvEntry->Entry().Complete() )
    {
    return;
    }

    // Read-only store.
    CMsvStore* store = iMsvEntry->ReadStoreL();
    CleanupStack::PushL(store);

    // Get address of received message.
    TBuf<KSmsMessageLength> iAddress(
    iMsvEntry->Entry().iDetails
    );
    TBool isSpam=EFalse;
    if (store->HasBodyTextL())
    {
    CRichText* richText = CRichText::NewL(
    CEikonEnv::Static()->SystemParaFormatLayerL(),
    CEikonEnv::Static()->SystemCharFormatLayerL());
    CleanupStack::PushL(richText);
    store->RestoreBodyTextL(*richText);
    const TInt length = richText->DocumentLength();

    // TBuf<KSmsMessageLength> number;
    TPtrC ptr = richText->Read(0, length);

    //iMessage = ptr;
    iMessage.Copy(ptr);
    //iLogView->DrawTextL( address );
    CleanupStack::PopAndDestroy(richText);


    isSpam=iObserver.MessageReceived(iAddress, iMessage);

    }
    else
    {
    isSpam=iObserver.MessageReceived(iAddress, KEmptyMsg);
    }

    CleanupStack::PopAndDestroy(store);

    // Automatic delete setting
    if ( isSpam )
    {
    // Ncnlist seems to panic if there is no time to play arrived
    // message tone before deletion.
    //Codescanner gives a critical
    TMsvEntry entry(iMsvEntry->Entry());
    if(entry.Unread())
    {
    entry.SetInPreparation(EFalse);
    entry.SetUnread(EFalse);
    iMsvEntry->ChangeL(entry);
    }

    User::After(KDelayTime);

    iMsvSession->RemoveEntry(iNewMessageId);

    iObserver.MessageDeleted();
    }
    }
    }
    break;

    default:
    break;
    }
    }


    This is my HandleSessionEventL method... where should i use that code........?

  8. #8
    Registered User
    Join Date
    Feb 2007
    Location
    India
    Posts
    1,128

    Re: How to turn off the vibrate and sound notification for incoming message ?

    Hi vimal, first you read carefully then after you try to use this code..

    void CSmsEngine::HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1,
    TAny* aArg2, TAny* /*aArg3*/)
    {
    switch (aEvent)
    {
    case EMsvServerReady:
    //for msg server initialisation......this thing is missing here
    iClientMtmReg = CClientMtmRegistry::NewL(*iMsvSession);
    iSmsMtm = static_cast<CSmsClientMtm*>(iClientMtmReg->NewMtmL(KUidMsgTypeSMS));
    // Initialise iMsvEntry


    if (!iMsvEntry)
    {
    iMsvEntry = CMsvEntry::NewL(*iMsvSession, KInbox,
    TMsvSelectionOrdering());
    }
    break;

    case EMsvEntriesChanged: //Use only don't use EMsvEntriesCreated
    //Look for changes. When using the emulator observed folder is
    //drafts, otherwise inbox.
    //Also a check for the iListeningForIncoming is made
    if (aArg2 && *(static_cast<TMsvId*>(aArg2)) ==KMsvGlobalInBoxIndexEntryId)
    {
    CMsvEntrySelection* entries =
    static_cast<CMsvEntrySelection*>(aArg1);

    if( entries->Count() < 1 )
    {
    Panic(ESmsEngineInternal);
    }
    else if (iNewMessageId == entries->At(0))
    {

    if( !iMsvEntry )
    {
    Panic(ESmsEngineNotInitialized);
    return;
    }

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

    // Check the type of the arrived message and that the
    // message is complete.
    // only SMS's are our consern.
    if ( iMsvEntry->Entry().iMtm != KUidMsgTypeSMS ||
    !iMsvEntry->Entry().Complete() )
    {
    return;
    }


    TMsvEntry entry(iMsvEntry->Entry());
    //entry.SetVisible(EFalse);
    if(entry.Unread())
    {
    entry.SetInPreparation(EFalse);
    entry.SetUnread(EFalse);
    iMsvEntry->ChangeL(entry);


    isSpam=iObserver.MessageReceived(iAddress, iMessage);

    }
    else
    {
    isSpam=iObserver.MessageReceived(iAddress, KEmptyMsg);
    }

    CleanupStack::PopAndDestroy(store);

    // Automatic delete setting
    if ( isSpam )
    {
    // Ncnlist seems to panic if there is no time to play arrived
    // message tone before deletion.
    //Codescanner gives a critical
    User::After(KDelayTime);

    iMsvSession->RemoveEntry(iNewMessageId);

    iObserver.MessageDeleted(); }
    }
    }
    break;

    default:
    break;
    }
    }

  9. #9
    Regular Contributor
    Join Date
    Feb 2007
    Location
    Indonesia
    Posts
    95

    Re: How to turn off the vibrate and sound notification for incoming message ?

    Hallo Kis_Spn

    Why can't I use the EMsvEntriesCreated?
    Is there some problems that will occur if I use this?

    Thanks!
    Thank You so much for your attention !

  10. #10
    Registered User
    Join Date
    Feb 2007
    Location
    India
    Posts
    1,128

    Re: How to turn off the vibrate and sound notification for incoming message ?

    Quote Originally Posted by ronaldwh
    Hallo Kis_Spn

    Why can't I use the EMsvEntriesCreated?
    Is there some problems that will occur if I use this?
    If you are using EMsvEntriesCreated in this case phone known all things about new entry that's why It generate sound, light, all these things.

  11. #11
    Registered User
    Join Date
    Mar 2007
    Location
    India
    Posts
    13

    Re: How to turn off the vibrate and sound notification for incoming message ?

    sorry,
    but i m not getting one thing that
    how "iNewMessageId" will init in ur code?

  12. #12
    Registered User
    Join Date
    Feb 2007
    Location
    India
    Posts
    1,128

    Re: How to turn off the vibrate and sound notification for incoming message ?

    Quote Originally Posted by vimal r jain
    sorry,
    but i m not getting one thing that
    how "iNewMessageId" will init in ur code?
    Ok this thing missing...So you can use in this way....
    if (aArg2 && *(static_cast<TMsvId*>(aArg2)) ==KMsvGlobalInBoxIndexEntryId)
    {
    CMsvEntrySelection* entries =
    static_cast<CMsvEntrySelection*>(aArg1);

    if( entries->Count() >= 1 )
    {
    iNewMessageId = entries->At(0);

    }
    else if (iNewMessageId == entries->At(0))
    {

    if( !iMsvEntry )
    {
    Panic(ESmsEngineNotInitialized);
    return;
    }

  13. #13
    Registered User
    Join Date
    Mar 2007
    Location
    India
    Posts
    13

    Re: How to turn off the vibrate and sound notification for incoming message ?

    Quote Originally Posted by kis_spn
    Ok this thing missing...So you can use in this way....
    if (aArg2 && *(static_cast<TMsvId*>(aArg2)) ==KMsvGlobalInBoxIndexEntryId)
    {
    CMsvEntrySelection* entries =
    static_cast<CMsvEntrySelection*>(aArg1);

    if( entries->Count() >= 1 )
    {
    iNewMessageId = entries->At(0);

    }
    else if (iNewMessageId == entries->At(0))
    {

    if( !iMsvEntry )
    {
    Panic(ESmsEngineNotInitialized);
    return;
    }

    i have tried this also but the o/p is same

  14. #14
    Registered User
    Join Date
    Jul 2007
    Posts
    15

    Re: How to turn off the vibrate and sound notification for incoming message ?

    Hi every1,

    is this problem will solve by MTM client or it can solve by MTM session?

    can v get sender number/address when new entry is in "preparing" state?
    ------------
    Mitul Nakum

  15. #15
    Regular Contributor
    Join Date
    Jul 2008
    Posts
    416

    Re: How to turn off the vibrate and sound notification for incoming message ?

    Hi developers,

    my configuration:
    phone: nokia n95 8gb
    sdk: S60_3rd_FP1
    Carbide C++: 1.3.1 b036

    my task:
    trying to receive a message without any sound or visual notifications

    project I'm trying to reproduce/change:
    S60_Platform_SMS_Example_v2_0_en.zip

    I'm trying to use:

    Code:
    TMsvEntry entry(iMsvEntry->Entry());
    //entry.SetVisible(EFalse);
    if(entry.Unread())
    {
    entry.SetInPreparation(EFalse);
    entry.SetUnread(EFalse);
    iMsvEntry->ChangeL(entry);
    in the EMsvEntriesChanged case in
    Code:
    void CSmsEngine::HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1,
                                               TAny* aArg2, TAny* /*aArg3*/)
    method.

    The visual notification disappears but there is still the notification sound available. Do you have any clue how to manage that?

    Thank you.

Similar Threads

  1. wap with sound / ring / vibrate
    By avi-sh in forum Browsing and Mark-ups
    Replies: 1
    Last Post: 2002-06-13, 19:31

Posting Permissions

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