Hi again :P
A few time ago i created application that receive SMS. It work great. But now, I have to do same but in deamon application, that run in background. So I created a new *.h and *.cpp file(in new project of course).
That file extends MMsvSessionObserver and override
HandleSessionEventL(TMsvSessionEvent aEvent, TAny *aArg1, TAny *aArg2, TAny *aArg3)
In E32Main I wrote:
In DoStartL() I create SchedulerCode:GLDEF_C TInt E32Main() { __UHEAP_MARK; CTrapCleanup* cleanup = CTrapCleanup::New(); DoStartL(); delete deamonEngine; delete cleanup; __UHEAP_MARKEND; return KErrNone; }
In MainL i created object to receive SMSCode:LOCAL_C void DoStartL() { // Create active scheduler (to run active objects) CActiveScheduler* scheduler = new (ELeave) CActiveScheduler(); // CleanupStack::PushL(scheduler);//it crash my app CActiveScheduler::Install(scheduler); MainL(); // Delete active scheduler CleanupStack::PopAndDestroy(scheduler); }
CDeamonEngine extends MMsvSessionObserver.Code:LOCAL_C void MainL() { TInt err; TRAP(err, deamonEngine = CDeamonEngine::NewL()); while(true) { User::After(500); } }
How to pause main thread, but don`t invoke CDeamonEngine? If I don`t use while, program will end, and if I use While, my applicatin don`t receive SMS. Have I to use ActiveObject, or create new Thread?
And other question, can i check is my Deamon is running? Not necessarily in Symbian. maybe I can check in by phone application?

Reply With Quote

