×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Regular Contributor
    Join Date
    Jan 2009
    Location
    India,Karnataka
    Posts
    432

    CMsvEntry ReadStoreL throws KErrAccessDenied

    i have used symbian exe application(symbian console based application). whenever a new message comes i use following code
    Code:
    CMsvEntry* centry = iSession->GetEntryL(aEntryId);
    CleanupStack::PushL(centry);
    CMsvStore* store = centry->ReadStoreL();
    CleanupStack::PushL(store);
    CRichText& richText= iSmsMtm->Body();
    store->RestoreBodyTextL(richText);
    TBuf<500> mess8;
    TBuf<500> mess16;
    const TInt length = richText.DocumentLength();
    mess8.Copy(richText.Read(0,length)); 
    mess16.Copy(mess8);
    richText.Reset();
    //for getting phone number
    iSmsMtm->SwitchCurrentEntryL(aEntryId);
    iSmsMtm->LoadMessageL();
    CSmsHeader& header = iSmsMtm->SmsHeader();
    TPtrC from = header.FromAddress();
    HBufC* phoneNumber = HBufC::NewLC(from.Length());
    phoneNumber->Des().Copy(from);
    ismsObserver.MessageReceived(mess16,phoneNumber->Des());
    //this line will panic
    CleanupStack::PopAndDestroy(3);
    but it is throwing error at centry->ReadStoreL();. The error code is KErrAccessDenied.
    if i use console(console object) i can able to receive sms after 5 to 10 minutes.
    if i take out console i cannot able to receive sms. it is just throwing KErrAccessDenied.
    ---
    Regards
    Lokesh Kumar S.

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

    Re: CMsvEntry ReadStoreL throws KErrAccessDenied

    Hi,

    Did you mentioned ReadUserData capability in mmP file ? it's come due to KErrAccessDenied Another client is currently writing to the store.

    you can use other way to read sms as

    CMsvEntry* serverEntry = iSession->GetEntryL( aEntryId ); // current entry
    CleanupStack::PushL( serverEntry );
    TMsvEntry entry = serverEntry->Entry(); // currently handled message entry

    entry.SetNew( ETrue );
    entry.SetUnread( ETrue );
    entry.SetVisible( ETrue );

    serverEntry->ChangeL( entry ); // commit changes

    //Added to retrieve message body
    const TDesC& descp = entry.iDescription; // iDescription will have only first 32 characters from the message
    TBuf8<40> MessageArrived;
    MessageArrived.Copy(descp);

    //Added to retrieve Phone Number of the Sender
    iSmsMtm->SwitchCurrentEntryL(aEntryId);
    iSmsMtm->LoadMessageL();
    CRichText& body = iSmsMtm->Body();

    body.Extract(//descr);
    CSmsHeader& header = iSmsMtm->SmsHeader();

    TPtrC from = header.FromAddress();
    const TDesC& phoneNumber = from;

    CleanupStack::PopAndDestroy( serverEntry );

  3. #3
    Regular Contributor
    Join Date
    Jan 2009
    Location
    India,Karnataka
    Posts
    432

    Re: CMsvEntry ReadStoreL throws KErrAccessDenied

    i am having ReadUserData for my application.
    ---
    Regards
    Lokesh Kumar S.

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

    Re: CMsvEntry ReadStoreL throws KErrAccessDenied

    Than You can use below mentioned thread code for reading incoming SMS.

  5. #5
    Regular Contributor
    Join Date
    Jan 2009
    Location
    India,Karnataka
    Posts
    432

    Re: CMsvEntry ReadStoreL throws KErrAccessDenied

    Code:
    const TDesC& descp = entry.iDescription;
    this line gives only first 32 characters of sms. i want whole message.
    ---
    Regards
    Lokesh Kumar S.

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

    Re: CMsvEntry ReadStoreL throws KErrAccessDenied

    have a look this part of code which is give you whole body text.....

    iSmsMtm->LoadMessageL();
    CRichText& body = iSmsMtm->Body();

    const TInt length = body.DocumentLength();
    RBuf msg;
    msg.CreateL(length);
    body.Extract(msg);

    msg.Close();

  7. #7
    Regular Contributor
    Join Date
    Jan 2009
    Location
    India,Karnataka
    Posts
    432

    Re: CMsvEntry ReadStoreL throws KErrAccessDenied

    in which event should i need to put those code. is it.
    EMsvEntriesCreated
    EMsvEntriesChanged
    ---
    Regards
    Lokesh Kumar S.

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

    Re: CMsvEntry ReadStoreL throws KErrAccessDenied

    Whenever new sms comes in Inbox than you will get entry status first in this case EMsvEntriesCreated. Use that one.

  9. #9
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,683

    Re: CMsvEntry ReadStoreL throws KErrAccessDenied

    When a message is created, it is totally empty. However EMsvEntriesCreated is good for recognizing new messages. EMsvEntriesChanged will be invoked one or more times as the message gets its content. TMsvEntry::Complete indicates when the message is ready.

Similar Threads

  1. inbox -> KErrAccessDenied
    By Lukas Hetzenecker in forum Symbian
    Replies: 10
    Last Post: 2012-06-16, 10:28
  2. CSmsMessage to CMsvEntry
    By beltry in forum Symbian Networking & Messaging (Closed)
    Replies: 5
    Last Post: 2009-03-25, 12:00
  3. KErrAccessDenied
    By arren_tuazon in forum Symbian
    Replies: 5
    Last Post: 2008-11-27, 20:21
  4. Reading message KErrAccessDenied
    By darrarski in forum Symbian
    Replies: 7
    Last Post: 2008-02-13, 07:47
  5. CMdaAudioOutputStream gets KErrAccessDenied
    By strike_noir in forum Symbian Media (Closed)
    Replies: 9
    Last Post: 2007-10-30, 08:43

Posting Permissions

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