Help regarding EXE

Login to reply to this topic.
Mon, 2008-08-25 12:00
Joined: 2007-08-26
Forum posts: 59

Hi,
I am working on 2nd edition. I have written an EXE which listens to the database and records any changes(new/modified). Right now i'm manually starting the EXE from file explorer but it can record only one change.
How can i make this EXE to always run on the phone.

Thanks,
Amit


Mon, 2008-08-25 12:08
Joined: 2008-06-23
Forum posts: 85
Re: Help regarding EXE
Mon, 2008-08-25 12:11
Joined: 2007-08-26
Forum posts: 59
Re: Help regarding EXE

This will start the EXE on boot. And my problem is how can i keep it running on the phone.

Mon, 2008-08-25 12:23
Joined: 2008-06-23
Forum posts: 85
Re: Help regarding EXE

Why, what makes it close?

Mon, 2008-08-25 12:48
Joined: 2007-08-26
Forum posts: 59
Re: Help regarding EXE

Register for notification

void CntNobtobserver:: ConstructL()
{
TRAPD(err, database = CContactDatabase::OpenL());
CleanupStack::PushL(database);
if(database)
{
changenotifier =CContactChangeNotifier::NewL(*database,this);
CleanupStack::PushL(changenotifier) ;
}
}
when the contact database changes HandleDatabaseEventL(TContactDbObserverEvent aEvent) gets called

I tried to but the ConstructL() inside while(1) when calling but its crashing. Sad

Mon, 2008-08-25 13:20
Joined: 2003-12-05
Forum posts: 672
Re: Help regarding EXE

Your code looks highly suspicious. Are those member variables there you are pushing to the cleanup stack (and leaving there)?? At least I do not see any local variable declarations in your code.

Mon, 2008-08-25 13:23
Joined: 2008-06-23
Forum posts: 85
Re: Help regarding EXE

At least you should make changenotifier and database member variables, otherwise you'll lose the pointer to them when returning from ConstructL. Crashing is very likely due to the improper memory handling (putting/leaving objects on the cleanupstack without really understanding why). I suggest you familiarize yourself more with these topics, it will save you a lot of trouble in the future.

Mon, 2008-08-25 13:26
Joined: 2003-12-05
Forum posts: 672
Re: Help regarding EXE

To clarify my comment -- you never, ever push member variables to the cleanup stack. And almost always when you are using asynchronous functionality (like notifications are) you need to put the object you are using as a member variable of some other object, which exists during the lifetime of the service you are using.

Mon, 2008-08-25 14:40
Joined: 2007-08-26
Forum posts: 59
Re: Help regarding EXE

Well, i'm deleting both the objects inside destructor .

and what about putting the constructL in while(1)

Mon, 2008-08-25 18:21
Joined: 2003-12-05
Forum posts: 672
Re: Help regarding EXE

Doing long running stuff in a while loop a) wastes the battery of the device fast if it lasts long and b) will result in WSERV 11 panic, if your gui app won't respond to window server queries in 10-30 seconds. How long does your loop run?

Mon, 2008-08-25 19:29
Joined: 2007-08-26
Forum posts: 59
Re: Help regarding EXE

hi andreas,
ya, that is very true. how to solve the issue.
regards,
Amit

Tue, 2008-08-26 07:14
Joined: 2003-12-05
Forum posts: 672
Re: Help regarding EXE

It depends on what you are trying to accomplish. Usually you need to use the active object framework, with an active scheduler and one or more active objects, which use the asynchronous services in the OS.

Wed, 2008-08-27 10:11
Joined: 2007-08-26
Forum posts: 59
Re: Help regarding EXE

Hi Andreas @ lvsti,
Thanks mate...got the problem solved .....

Regards,
Amit

  • Login to reply to this topic.