Create Local SMS - 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
#include
#include
#include
#include
#include
#include
LIBRARY msgs.lib smcm.lib gsmu.lib
Labels: Symbian Create Local SMS

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home