intercept sms
| Fri, 2006-12-01 12:17 | |
|
Hi to all
I want intercept the creation of an sms. I've read many examples so the solution is to use an observer: class CSmsEngine : public CBase, public MMsvSessionObserver { public: static CSmsEngine* NewL(); ~CSmsEngine(); void CreateLocalMessageL( TMsvId aFolderId, const TDesC& aAddress, const TDesC& aDescription, const TDesC& aMsgText ); private: void ConstructL(); // from MMsvSessionObserver void HandleSessionEventL( TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3 ); private: // SMS client MTM interface CSmsClientMtm* iSmsMtm; // Represents a session to the messaging server CMsvSession* iSession; // This registry holds details of the all the Client-side // MTMs currently available on the system. CClientMtmRegistry* iClientMtmReg; // The last "clone" TMsvId iLastChangedMessageId; }; void CSmsEngine::ConstructL() { // Connect to the Messaging server // Upon successful connection HandleSessionEventL (EMsvServerReady) // will be called iSession = CMsvSession::OpenSyncL( *this ); //iSession->AddObserverL(*this); iClientMtmReg = CClientMtmRegistry::NewL(*iSession); // Get the SMS Mtm client from the registry iSmsMtm = static_cast<CSmsClientMtm*>( iClientMtmReg->NewMtmL( KUidMsgTypeSMS ) ); } I want to use this class in an console program: LOCAL_C void MainL(const TDesC& aArgs) { const TMsvId KInbox = KMsvGlobalInBoxIndexEntryId; CSmsEngine * iEngine = CSmsEngine::NewL(); iEngine->CreateLocalMessageL( KInbox, _L("+3333333333"), _L("subject "), _L("body") ); delete iEngine; } Now the message is created but i can't intercept the creation because the callback HandleSessionEventL isn't called. Notice that the smsengine module works well in an .app program. Any suggestion? thanks symbnew |
|






Forum posts: 98
i am not getting what you want to do ?
Can explain in detail what you want to do ?
Thanks and Regards,
Yogesh