This page was last modified 09:22, 26 November 2007.
Create Local SMS
From Forum Nokia Wiki
Using the following code an SMS can be created in the local Inbox. The user gets a new message with the SMS alert tone (if profile not silent). SMS does not use network services ,its just created locally.
void CMobloggerPhotoEngine::SMS2Inbox() { iSendingSms=ETrue; TBuf<10> aAddress(_L("Nokia")); TBuf<20> aDescription(_L("Important Message")); _LIT(KTxt1,"Hi phone owner, how r u?"); TBuf<150> iMessage; iMessage.Copy(KTxt1); iMtmRegistry = CClientMtmRegistry::NewL(*iSession); iSmsMtm = STATIC_CAST( CSmsClientMtm*, iMtmRegistry->NewMtmL(KUidMsgTypeSMS)); iSmsMtm->SwitchCurrentEntryL(KMsvGlobalInBoxIndexEntryId); //inbox iSmsMtm->CreateMessageL(KUidMsgTypeSMS.iUid); CSmsHeader& iHeader = iSmsMtm->SmsHeader(); iHeader.SetFromAddressL(aAddress); CRichText& body = iSmsMtm->Body(); body.Reset(); body.InsertL(0, iMessage); TMsvEntry entry = iSmsMtm->Entry().Entry(); entry.SetInPreparation(EFalse); entry.SetVisible(ETrue); entry.iDate.HomeTime(); entry.iDescription.Set(aDescription); entry.iDetails.Set(aAddress); entry.SetUnread(ETrue); iSmsMtm->Entry().ChangeL(entry); iSmsMtm->SaveMessageL(); }
the following are the header files required
#include <msvapi.h> #include <mtclreg.h> #include <SMSCLNT.h> #include <msvstd.h> #include <smut.h> #include <txtrich.h> #include <SMUTHDR.h> LIBRARY msgs.lib smcm.lib gsmu.lib
Lots of other SMS related operations are on this page SMS Operations.
| Related Discussions | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Sending SMS from Midlet | lahvenai | Mobile Java General | 0 | 2004-05-04 13:44 |
| Java App for sending sms | npoddar | Mobile Java General | 6 | 2004-01-21 09:28 |
| Getting started using C++ to create an WML / WAP Product ??? | stephenwhire68 | Browsing and Mark-ups | 2 | 2002-07-09 09:16 |
| loading and sending an sms | marwa mohamed | General Symbian C++ | 2 | 2006-06-07 15:19 |
| how can i receive a SMS | abzithom | PC Suite API and PC Connectivity SDK | 0 | 2002-07-25 11:19 |
