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
Highlighted
Developer
Posts: 22
Registered: ‎01-16-2009
My Device: Not Specified
Accepted Solution

Terminating a background-process

Dear all,


short question: I have two background-processes. One process may be notified to shut itself down by SMS. But when it shuts down I want to shut down my second process as well. Whats the best way to do this?

I am thinking of placing a "note" into the runtime-store before shutting down the first process. If the second process reads the note it shuts down as well. Problem: I may deinstall my first process and then I need a reboot. After the reboot my note is lost (the second process sleeps most of the time...) and the second process wont shut down... Same problem using persistent store when removing my application....

Any ideas?

 

Thanks!

Steve

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

Re: Terminating a background-process

if you use generic persistant objects, like a string for example or a Boolean, they do not get removed when you uninstall an application.
----------------------------------------------------------
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: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Terminating a background-process

Further to Simon's note, RuntimeStore does not survive a reboot, so don't put a note in there.

 

You might also consider putting code into the second application to see if the first is actually there.  Never done this myself, but if I was too, I would look at ApplicationManager to see if the application is running or CodeModuleManager to see if the associated cod was there.  But I suspect either of these is a more work than using PersistentStore.

Developer
Posts: 22
Registered: ‎01-16-2009
My Device: Not Specified

Re: Terminating a background-process

Hi Simon, hi Peter,

 

thanks for your replies! I will but a boolean in the persistent-store then.

 

Peter: I know the cod is there and running, i check it using the ApplicationManager. But nevertheless I cant terminate a application using the ApplicationManager, or do i misunderstand something?

 

Thanks again,

Steve

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

Re: Terminating a background-process

if the application is yours you can send a termination command via global event.
----------------------------------------------------------
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: 22
Registered: ‎01-16-2009
My Device: Not Specified

Re: Terminating a background-process

i knew i missed something! thanks thats the solution i was looking for!
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Terminating a background-process

My post was intended to assist in the case when you had removed the first application and so did not want the second running.  I am not aware of any way through ApplicationManager that you can terminate another application, but I've never really wanted to do anything like that so I've never looked.
Developer
Posts: 22
Registered: ‎01-16-2009
My Device: Not Specified

Re: Terminating a background-process

sorry i misplaced the solution-button. any chance to change that ...?!?

 

 

Developer
Posts: 1,477
Registered: ‎12-30-2008
My Device: Torch 9810

Re: Terminating a background-process

[ Edited ]

Original:

Some people ask questions

 

Some experts answers questions

 

questioner, says thanks thats the solution and mark their own reply as accepted solution, rather putting the solution as accepted

:LMAO:

 

Edited:

Sorry buddy, I thought it was not by mistake :LOL:

Message Edited by mantaker on 03-28-2009 09:26 AM
--
Manimaran Selvan
Co-Founder, Tech Lead,
Equity Markets Research Group
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Terminating a background-process