Discussion Board

Page 1 of 3 123 LastLast
Results 1 to 15 of 34
  1. #1
    Regular Contributor
    Join Date
    Sep 2008
    Location
    Pune - India
    Posts
    378

    Unhappy [moved] Receiving SMS silently..

    Hello Friends,

    I am working on series 60 2nd edition.
    I want to receive messages without any tone, without blink of light and without vibration alert.
    can anybody give me example or some guidence regarding this..
    Its urgent..


    Thanking you in advance...

  2. #2
    Super Contributor
    Join Date
    Jan 2007
    Location
    Bhubaneswar, India
    Posts
    1,189

    Re: Receiving SMS silently..

    Quote Originally Posted by amol_benare604 View Post
    Hello Friends,

    I am working on series 60 2nd edition.
    I want to receive messages without any tone, without blink of light and without vibration alert.
    can anybody give me example or some guidence regarding this..
    Its urgent..


    Thanking you in advance...
    check this link
    http://discussion.forum.nokia.com/fo...d.php?t=112852
    -------------------------------------
    Thanks & Regards
    Ram
    Symbian OS 9.2/9.3,S60 3rd FP1/FP2,Carbide.c++v2.0

  3. #3
    Regular Contributor
    Join Date
    Sep 2008
    Location
    Pune - India
    Posts
    378

    Re: Receiving SMS silently..

    This is the code i m using ..
    I hav inserted code snipet from link provided by you but its not working....can u plz guide me...

    case EMsvEntriesChanged:
    // Look for changes. When using the emulator observed folder is drafts, otherwise inbox.
    if (*(static_cast<TMsvId*>(aArg2)) == KObservedFolderId)
    {
    CMsvEntrySelection* entries = static_cast<CMsvEntrySelection*>(aArg1);
    if (iNewMessageId == entries->At(0))
    {
    // Set entry context to the new message
    iMsvEntry->SetEntryL(iNewMessageId);

    //New Development

    /*iMsvEntry->CreateL(entry);

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








    // Check the type of the arrived message and that the message is complete.
    // only SMS 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.
    iLogView->LogEventBeginningL();
    TBuf<KSmsMessageLength> address ( iMsvEntry->Entry().iDetails );
    iLogView->DrawTextL( address );

    if (store->HasBodyTextL())
    {
    CRichText* richText = CRichText::NewL(
    iEikonEnv->SystemParaFormatLayerL(),
    iEikonEnv->SystemCharFormatLayerL());
    CleanupStack::PushL(richText);
    store->RestoreBodyTextL(*richText);
    const TInt length = richText->DocumentLength();

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

    // Try to find a number that has 10 or more digits from message body.
    // Underline found number.
    if ( iParser->ParseMessage( ptr, number ))
    {
    // Search number position in the message body
    TInt pos = richText->Read(0, length).Find( number );

    iLogView->DrawTextWithoutCarriageL( richText->Read(0, pos) );
    iLogView->DrawUnderlinedTextL( richText->Read(pos , number.Length()) );
    iLogView->DrawTextWithoutCarriageL( richText->Read(pos + number.Length() , length));
    }
    else
    {
    iLogView->DrawTextL( richText->Read(0, length) );
    }
    CleanupStack::PopAndDestroy(richText);
    }
    else
    {
    iLogView->DrawTextL( KNoBodyText );
    }

    CleanupStack::PopAndDestroy(store);

    // Automatic delete setting
    if ( iAutomaticDelete )
    {
    // Ncnlist seems to panic if there is no time to play arrived
    // message tone before deletion.
    User::After(1000*3000);
    iLogView->LogEventBeginningL();
    iLogView->DrawTextL( KAutomaticDeletedMesssageText );
    iMsvSession->RemoveEntry(iNewMessageId);
    }
    }
    }
    break;

  4. #4
    Registered User
    Join Date
    Feb 2008
    Location
    India
    Posts
    92

    Re: Receiving SMS silently..

    Hi,

    Check this link.


    Regards,
    Suyash

  5. #5
    Regular Contributor
    Join Date
    Feb 2008
    Location
    Pune, India
    Posts
    340

    Re: Receiving SMS silently..

    The link Suyash provided will help only if you want to receive the message via sockets. In case, you feel its "difficult" or you don't want to do it in that manner, you can still achieve what you want by simply marking the message as "read" as soon as you receive the notification in EMsvEntriesCreated. You can do it using the code below,

    Code:
    /**
     * Just in case we need such a function in future that marks a message as "read"
     * @return - NONE
     * */
    void SMSMonitor::MarkMsgAsRead()
    {
        // There is an own registry for UI MTM's.
       iMtmUiReg = CMtmUiRegistry::NewL( *iSession );
    
       CMsvEntry* serverEntry = iSession->GetEntryL( iMessageId );
       CleanupStack::PushL( serverEntry );
    
       // Create new MTM.
       CBaseMtm* clientMtm = iMtmRegistry->NewMtmL( serverEntry->Entry().iMtm );// );
    
       CleanupStack::PushL( clientMtm );
       clientMtm->SwitchCurrentEntryL( serverEntry->EntryId() );
    
       TMsvEntry entry( serverEntry->Entry() );
       entry.SetNew( EFalse );         // message is no longer new
       entry.SetUnread( EFalse );      // message is no longer unread
       serverEntry->ChangeL( entry );  // commit changes
       CleanupStack::PopAndDestroy( 2 ); // clientMtm, serverEntry
    }
    Regards,
    Sainagakishore Srikantham (Kishore)

    Don't Hope, KNOW!!! ---------- Visit me at http://ssnkishore.blogspot.com ----------

  6. #6
    Regular Contributor
    Join Date
    Sep 2008
    Location
    Pune - India
    Posts
    378

    Smile Re: Receiving SMS silently..

    Thanks a lot friends,
    I got solution for my problem because of u guies only thank you very much...

  7. #7
    Regular Contributor
    Join Date
    Feb 2008
    Posts
    269

    Re: [moved] Receiving SMS silently..

    Hi Kishore,

    I tried as you told, but it is not working.

    I code liked this:

    TMsvId* messageId = STATIC_CAST( TMsvId*, aArg2 );

    CClientMtmRegistry* iCClientMtmRegistry = CClientMtmRegistry::NewL( *iSession );

    CMsvEntry* serverEntry = iSession->GetEntryL( *messageId );
    CleanupStack::PushL( serverEntry );

    // Create new MTM.
    //CBaseMtm* clientMtm = iCClientMtmRegistry ->NewMtmL( serverEntry->Entry().iMtm );
    CBaseMtm* clientMtm = iMtmRegistry->NewMtmL( serverEntry->Entry().iMtm );

    CleanupStack::PushL( clientMtm );
    clientMtm->SwitchCurrentEntryL( serverEntry->EntryId() );

    TMsvEntry entry( serverEntry->Entry() );
    entry.SetNew( EFalse ); // message is no longer new
    entry.SetUnread( EFalse ); // message is no longer unread
    serverEntry->ChangeL( entry ); // commit changes
    CleanupStack::PopAndDestroy( 2 ); // clientMtm, serverEntry

    I have include these code in EMsvEntriesCreated, but is not working.

    Can you please help me to find it out.

    Regards,
    Santu

  8. #8
    Regular Contributor
    Join Date
    Feb 2008
    Location
    Pune, India
    Posts
    340

    Re: [moved] Receiving SMS silently..

    Hello Santu,

    The code snippet I posted will mark any message with a particular "message id" as unread. In case you want to mark the message that has just been received as unread you need the message id of that message. The id can be found using this snippet,

    Code:
    TMsvSelectionOrdering sort;
    sort.SetSorting(EMsvSortByDate);
    sort.SetShowInvisibleEntries(ETrue); // we want to handle also the invisible entries
     
    CMsvEntry* parentEntry = CMsvEntry::NewL(*iSession, KMsvSentEntryId, sort);
    CleanupStack::PushL(parentEntry);
    	
    CMsvEntrySelection* entries = parentEntry->ChildrenL();
    CleanupStack::PushL(entries);
    		
    for(TInt i = 0; i < entries->Count(); i++)
    {
    	 if( parentEntry->ChildDataL(entries->At(i)).iMtmData3 != KUidMsgTypeSMS.iUid )
    	 {
    MarkMsgAsRead(entries->At(i).EntryId()); // call our function
    	 }
    }
    Regards,
    Sainagakishore Srikantham (Kishore)

    Don't Hope, KNOW!!! ---------- Visit me at http://ssnkishore.blogspot.com ----------

  9. #9
    Regular Contributor
    Join Date
    Feb 2008
    Posts
    269

    Re: [moved] Receiving SMS silently..

    Hi Kishore,

    An error is coming at the line

    MarkMsgAsRead(entries->At(i).EntryId()); // call our function

    Mainly this entries->At(i).EntryId() is giving the error.

    The error is
    request for member `EntryId' in `entries->CArrayFix<long int>::At<TMsvId>(int)(i)', which is of non-aggregate type `long int'


    So can you tell why this error is coming?

    Regards,
    Santu

  10. #10
    Regular Contributor
    Join Date
    Feb 2008
    Location
    Pune, India
    Posts
    340

    Re: [moved] Receiving SMS silently..

    Please use the following code snippet. Sorry for the inconvenience.

    Code:
    case EMsvEntriesCreated:      
    			{
    	            TMsvId* entryId = static_cast<TMsvId*>(aArg2);         
    
    	            if ( *entryId == KMsvGlobalInBoxIndexEntryId )  
    	            {
    	            CMsvEntrySelection* entries = static_cast<CMsvEntrySelection*>(aArg1);
    	        	if(entries)
    			{
            				CMsvEntry* entry = 0;
    		                for(TInt i = 0; i < entries->Count(); i++)
    		                {	
    			                entry = iSession->GetEntryL(entries->At(i));  
    			            	CleanupStack::PushL(entry);
    			            	EMsgType msgType;
    			            	if(entry->Entry().iMtm == KUidMsgTypeSMS)
    			            	{ 
    			            	MarkMsgAsRead(entry->EntryId());
    			            	}
    				}
    			}
    		}
    Use the following code for the function,

    Code:
    /**
     * Just in case we need such a function in future that marks a message as "read"
     * @return - NONE
     * */
    void SMSMonitor::MarkMsgAsRead(TMsvId aMessageId)
    {
        // There is an own registry for UI MTM's.
       iMtmUiReg = CMtmUiRegistry::NewL( *iSession );
    
       CMsvEntry* serverEntry = iSession->GetEntryL( aMessageId );
       CleanupStack::PushL( serverEntry );
    
       // Create new MTM.
       CBaseMtm* clientMtm = iMtmRegistry->NewMtmL( serverEntry->Entry().iMtm );// );
    
       CleanupStack::PushL( clientMtm );
       clientMtm->SwitchCurrentEntryL( serverEntry->EntryId() );
    
       TMsvEntry entry( serverEntry->Entry() );
       entry.SetNew( EFalse );         // message is no longer new
       entry.SetUnread( EFalse );      // message is no longer unread
       serverEntry->ChangeL( entry );  // commit changes
       CleanupStack::PopAndDestroy( 2 ); // clientMtm, serverEntry
    }
    Regards,
    Sainagakishore Srikantham (Kishore)

    Don't Hope, KNOW!!! ---------- Visit me at http://ssnkishore.blogspot.com ----------

  11. #11
    Regular Contributor
    Join Date
    Feb 2008
    Posts
    269

    Re: [moved] Receiving SMS silently..

    Hi Kishore,

    Thanks for your reply. When the sms comes it is silent but it is not showing in the inbox. So where the msg gone?

    Regards,
    Santu

  12. #12
    Regular Contributor
    Join Date
    Feb 2008
    Location
    Pune, India
    Posts
    340

    Re: [moved] Receiving SMS silently..

    Try this as the change in MarkMsgAsRead();

    Change the last statement to the statements below and let me know.

    Code:
    CleanupStack::PopAndDestroy( 1 ); // clientMtm
    CleanupStack::Pop( 1 );// serverEntry
    Regards,
    Sainagakishore Srikantham (Kishore)

    Don't Hope, KNOW!!! ---------- Visit me at http://ssnkishore.blogspot.com ----------

  13. #13
    Regular Contributor
    Join Date
    Feb 2008
    Posts
    269

    Re: [moved] Receiving SMS silently..

    The application is closing and also the message is not showing in the inbox. What may be the reason?

    Regards
    Santu

  14. #14
    Regular Contributor
    Join Date
    Feb 2008
    Location
    Pune, India
    Posts
    340

    Re: [moved] Receiving SMS silently..

    One last time please try all the working code in EMsvEnriesMoved (The one that worked before modifying MarkMsgAsRead with two statements).

    The thing is, once the phone moves the entry into the Inbox, we can PopAndDestroy the CMsvEntry pointer but when we are marking the message as read in EMsvEntriesCreated case we should take the responsibility of moving it to the Inbox. I had written that code as well but I no more work in Symbian and don't have the code with me right now. I am trying to help you by remembering some code and using my own from this forum

    Let me know if it worked!
    Regards,
    Sainagakishore Srikantham (Kishore)

    Don't Hope, KNOW!!! ---------- Visit me at http://ssnkishore.blogspot.com ----------

  15. #15
    Regular Contributor
    Join Date
    Feb 2008
    Posts
    269

    Re: [moved] Receiving SMS silently..

    I tried that, this time it is not working. I think EMsvEnriesMoved enter only when the message move, but for incoming sms it directly goes to inbox means EMsvEntriesCreated. I have used EMsvEnriesMoved for reading sent sms. For sending sms,the sms move from draft to sent box. So will it work if write your code in EMsvEnriesMoved. Now what to do?

    Regards,
    Santu

Similar Threads

  1. receiving a wap push message silently
    By cmryan in forum Symbian
    Replies: 10
    Last Post: 2009-06-03, 15:15
  2. Receiving SMS by J2ME Midlet on 3410
    By mlamb in forum Mobile Java General
    Replies: 6
    Last Post: 2009-03-24, 14:13
  3. [moved] Receiving WAP Push message
    By doctordwarf in forum Symbian Networking & Messaging (Closed)
    Replies: 10
    Last Post: 2008-10-01, 06:20
  4. Receiving a WAP-PUSH SMS
    By coolste23 in forum Mobile Java Networking & Messaging & Security
    Replies: 3
    Last Post: 2007-07-26, 01:05
  5. Sms Problem!!! Not Receiving
    By zmaster_d in forum Mobile Java Networking & Messaging & Security
    Replies: 6
    Last Post: 2007-07-18, 20:38

Posting Permissions

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