05-17-2010 10:48 AM
Hi guys,
I am working on a program which when instructed(by invoking a system menu item) does some processing of the addressbook. In the current architecture, the program is exited after the mentioned processing and when the next time the menu item is invoked, the program is restarted which then knows it has to start the processing.
My problem is that now i want the adressbook processing to be automatic which would be done periodically. I would need a thread running continuously for scheduling the processing but i am unable to do that as when i am exiting the program the thread is dying.
Due to existing architecture, its is really for me to keep the program running and calling some kind of method to initiate the adreessbook processing from system menu which i understand will let me keep the thread alive too.
What do you guys suggest here?
Solved! Go to Solution.
05-17-2010 11:01 AM
you can either have a background process running all the time (idle most of it). or use applicationmanager.scheduleapplication to schedule your app.
05-17-2010 11:06 AM - edited 05-17-2010 11:06 AM
Hello,
you can schedule your application to start at specified time.
ApplicationManager appManager = ApplicationManager.getApplicationManager(); ApplicationDescriptor appDesc = ApplicationDescriptor.currentApplicationDescriptor(); appManager.scheduleApplication(appDesc, new Date().getTime() + timeDelay, true);
The code above is not tested and provided for information.
05-17-2010 11:08 AM - edited 05-17-2010 11:11 AM
for background apps, you can refer here:
checkout those articles. and you can start from there.
05-17-2010 11:09 AM
Thanks simon.
Do you mean a thread spawned by the app by background process? In that case its not really working for me as due to architecural limitation i cant keep my program running all the time and if i exit the program, the scheduling thread is dying with it.
05-17-2010 11:17 AM
you can have several entry points with different programs, one could run all the time, for example.
or you just use the schedule application also pointed out by the other posters.