Using SMS "folders" from Code.

Login to reply to this topic.
Wed, 2005-05-11 17:23
Joined: 2005-04-22
Forum posts: 9
Hi all,

My purpose is to (among others)
1, create a new SMS folder from code
2, be able to move SMS messages from the Inbox to some other SMS folder.

I am still scratching the surface of Symbian and my application is currently able to receive SMS messages in the HandleSessionEventL callback of a MMsvSessionObserver. I now have the CSmsClientMtm with the SMS and now i wonder what's next. Smiley i guess moving to another folder is not hard, but creating a folder beats me.

i try to create a new folder this way, but no folder appears at all on the device/emulator.

Code:

          ...
          iReceiveSession = CMsvSession::OpenSyncL(*this);
          ...

         //get to messaging root, if currently at message level
          CMsvEntry* iMsvEntry = iReceiveSession->GetEntryL(entry.Parent()); //inbox folder
          iMsvEntry = iReceiveSession->GetEntryL(iMsvEntry->Entry().Parent()); //the messaging root
         
          TTime date;
          date.HomeTime();
          _LIT(teststr,"testfolder");
         
          TMsvEntry* folderentry = new (ELeave) TMsvEntry();

          folderentry->iType = KUidMsvFolderEntry;  //i want a folder
          folderentry->iMtm =  KUidMsvLocalServiceMtm;  //..a local folder
          folderentry->iDetails.Set(teststr);
          folderentry->iDescription.Set(teststr);
          folderentry->iServiceId = smsMtm->ServiceId();
          folderentry->iSize = sizeof(folderentry);
          folderentry->iDate= date;
          folderentry->SetStandardFolder(ETrue);
          folderentry->SetVisible(ETrue);

          iMsvEntry->CreateL(*folderentry);
                   

Any help is greatly appreciated (i may even send you a nice postcard from where i live Smiley ),
simon b

- - - - - - -

simon b


Thu, 2005-05-26 10:53
Joined: 2005-04-22
Forum posts: 9
Re: Using SMS "folders" from Code.
aw, i reply to myself for the common good, it should be KUidMsgTypeSMS instead of KUidMsvLocalServiceMtm and then it is displayed on the device, yet not in the emulator.. oh my  Afro

ok so this issue is closed, bye folks.

- - - - - - -

simon b

Thu, 2005-05-26 12:58
Joined: 2005-03-21
Forum posts: 45
Re: Using SMS "folders" from Code.
Hi,

Iam working on a application which needs to listen for incoming SMS. can u please help me to do this, how do i test it in emualtor.
Fri, 2005-05-27 10:20
Joined: 2005-04-22
Forum posts: 9
Re: Using SMS "folders" from Code.
You have to provide the MTM an implementation of MMsvSessionObserver::HandleSessionEventL where you would be notified about MTM events including an incoming SMS. Then you load the message into a CMsvEntry and make it the current entry of the CSmsClientMtm you are registered with. Then the CSmsClientMtm would give you access to sms data of all kind.

As for testing, well just work with the drafts folder on the emulator and the real inbox on the device (a matter of an #ifdef), that is, you can feed your app with draft messages for testing.

- - - - - - -

simon b

Sat, 2005-06-11 05:36
Joined: 2005-04-07
Forum posts: 6
Re: Using SMS "folders" from Code.
Code:
smsMtm->ServiceId();
Could you please explain how to initialize smsMtm?
Mon, 2005-06-13 17:00
Joined: 2005-06-13
Forum posts: 1
Re: Using SMS "folders" from Code.
Hi friends, I'm new to symbian c++ programming (also I'm new to c++ programming!) and I need to learn very fast that language for same projects..
Can you send me the link to some examples of how set up a sms receiver/sender?

I'll tried the nokia eample, but it doesn't run on nokia 6600 'cause it's not a 'feature pack 3' of the second edition...  Sad

I need something that receive sms and parse them..
I hope in you.. please help me!
Wed, 2005-06-22 03:38
Joined: 2004-09-10
Forum posts: 18
Re: Using SMS "folders" from Code.
Hi can I ask if this code actually works? Because I tried it and it's not working that well. Is the folder supposed to come out in the My Folders? Or somewhere else? Thanks..
Wed, 2005-06-22 08:33
Joined: 2005-04-22
Forum posts: 9
Re: Using SMS "folders" from Code.
Hi, you won't see the folder in the emulator for some reason, only on the phone. It will turn up under local folders. Actually only if you restart the messaging app.. it is caching the tree structure so the changes you make will be visible only upon phone restart or if you kill and restart the messaging app.

I still did not get a workaround for the caching issue, i guess it is something more involved than i have the time for.


- - - - - - -

simon b

Tue, 2005-06-28 02:51
Joined: 2004-09-10
Forum posts: 18
Re: Using SMS "folders" from Code.
I got it to show up in the My folders.. But now the problem is that it doesn't want to deleted. Something about Access Denied error. Did you encounter this?
And what do you mean by local folders? Are those the one under the 'C:\System\Mail\' Folder or the one that appears when you open the messaging App? I'm using n3660, is that why it's not working?
Tue, 2005-06-28 12:47
Joined: 2005-04-22
Forum posts: 9
Re: Using SMS "folders" from Code.
Hi fellow SMS sufferer Smiley,

make sure to set the type to KUidMsgTypeSMS rather than KUidMsvLocalServiceMtm otherwise there gonna be problems erasing the folders. (Apparently a bug, you can create entries in the MTM tree with MTM id KUidMsvLocalServiceMtm  but you can't delete them.. ) i had to delete the messaging index file on the device to let these folders disappear.
Local folders >> on my p910 i have a dropdown that lets me choose from "inbox, sent messages, drafts, outbox" and then below these is a marker "local folders" and these folders created from code appear below the marker line. They go under
C:\System\Mail\ like anything else, sure.

As for folders showing up, do you see them appear instantly after the code runs? Like i said i had a hard time with this but could not force the system to reload the MTM tree for the messaging app, so i saw the folders only if i killed the messaging app and started it again, or if i restarted the whole phone itself. Now im busy at job so can't poke with this for now.. Sad

anybody got a hint for this latter problem?

cheers,
simon b


- - - - - - -

simon b

Tue, 2005-08-16 11:48
Joined: 2005-04-22
Forum posts: 9
Re: Using SMS "folders" from Code.
Hi,

here http://360.yahoo.com/simonkleinn i posted the code because i did not get a chance to deal with it for so long... i hope i help others, and also thank for the posts on the web from other people who helped.

cheers
simon b

- - - - - - -

simon b

  • Login to reply to this topic.