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: 131
Registered: ‎08-13-2008
My Device: Not Specified

Autostarted or user initiated?

My autostart application has only one entry point and it creates a GUI on startup. The user can terminate the app whenever they want. So no matter it is autostarted or user initiated (re-launched after exiting), it goes through the same chunk of code. If it is user initiated, I need to ignore the autostart flag, so it doesn't call System.exit(0) if false.

 

Is there any way to tell the difference?

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

Re: Autostarted or user initiated?

use two entry points

----------------------------------------------------------
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
Highlighted
Developer
Posts: 131
Registered: ‎08-13-2008
My Device: Not Specified

Re: Autostarted or user initiated?

The problem with alternate entry points is that you can hardly terminate the background process (and make it possible to be restarted). 

 

I want to do the following:

-Startup, system module started

-Alternate entry point entered - launch GUI, system module already running

-(!) Exit, both processes killed

-Alternate entry point entered - (!) System module not running, start system module, then launch GUI (not possible because you will need to enterEventDispatcher() twice?)

 

In this case, should I just call close() on the GUI component so the icon disappears, giving the illusion it is closed? (Will also need to unregister some listeners too)

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

Re: Autostarted or user initiated?

why do you want to restart the background process? it is possible, of course, to do so, for example by posting a global event and calling System.exit on reception in the process.

you can run an alternate entry point process by using the correct applicationdescriptor in applicationmanager.

 

would be easier to cease processing though and just resume it on event reception.

 

i usually just put my GUI to the background or ask the user about it.

i am not concerned about my background processes running, they usually have a very low footprint.

----------------------------------------------------------
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