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
New Developer
blisterpeanuts
Posts: 15
Registered: ‎08-31-2010
My Device: Not Specified

Restarting an app without long delay

I'd like to have my app exit and restart instantly.  Is this possible?  I implemented the following code, which works but the app doesn't restart for about 30 seconds on my Bold.  I would like it to close and restart immediately.  

 

// schedule a restart, and shut down

ApplicationDescriptor thisApp = ApplicationDescriptor.currentApplicationDescriptor();

ApplicationManager.getApplicationManager().scheduleApplication(thisApp, System.currentTimeMillis(), true);

System.exit(0);

 

I tried the runApplication() method instead but the app never came back up.

 

// schedule a restart, and shut down

ApplicationDescriptor thisApp = ApplicationDescriptor.currentApplicationDescriptor();

ApplicationManager.getApplicationManager().runApplication(thisApp, true);

System.exit(0);

 

Is there a better way to do this?  The use case is to refresh the app after user changes some settings.  It seemed easier to restart than to handle onExposed() with a whole bunch of flags, but maybe I'll have to :smileysad:

New Developer
blisterpeanuts
Posts: 15
Registered: ‎08-31-2010
My Device: Not Specified

Re: Restarting an app without long delay

Bump!

 

Any comments or suggestions would be appreciated!

Developer
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: Restarting an app without long delay

maybe with a second (background) application. send a global event to it before you exit, and it will launch the main app again.

sounds strange though, applying settings should work without a restart.
----------------------------------------------------------
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