Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 76
Registered: ‎02-21-2009
My Device: Not Specified
Accepted Solution

Background application

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?

Highlighted
Developer
Posts: 17,012
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Background application

you can either have a background process running all the time (idle most of it). or use applicationmanager.scheduleapplication to schedule your app.

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 166
Registered: ‎01-14-2009
My Device: Curve 8330

Re: Background application

[ Edited ]

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.

 

Thank you, have a nice day.

--
Samuel D.
Developer
Posts: 905
Registered: ‎02-07-2009
My Device: BlackBerry Torch 9800
My Carrier: Globe Telecom

Re: Background application

[ Edited ]
Developer
Posts: 76
Registered: ‎02-21-2009
My Device: Not Specified

Re: Background application

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.

 

 

Developer
Posts: 17,012
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Background application

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.

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter