You Are Here:

Community: Wiki

This page was last modified on 3 September 2009, at 20:26.

Create Local SMS

From Forum Nokia Wiki

Reviewer Approved   

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

Related Links:

Related Wiki Articles

No related wiki articles found

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2findeE78E2ephpE2fMessageE5fhandlingE5finE5fJavaE5fPlatfromE2cE5fMicroE5fE45ditionE5fE28JavaE5fME45E29X qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqfntypeZWikiContentQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZmessagingQ qfnZtopicQUqfnTopicZsmsQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZtypeQUqfntypeZWikiContentQ qfnZuserE5ftagQSxmessagingX qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqfntypeZWikiContentQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ