09-13-2009 06:53 PM
Hi,
this flag exists in ApplicationDescriptor however I cannot see how to set this flag to an application other than running it from within another application (i.e. programmatically).
Project in Eclipse does not have any relevant settings. Maybe it is possible through modifying XML/JDP descriptor directly ? But then the JDP file is rewritten every time.
Any ideas?
Thanks,
Nikolay
Solved! Go to Solution.
10-01-2009 08:01 PM
10-01-2009 11:12 PM
As you can see - I got nothing so far.
Looks like this is unavailable as app standard config option - you'll have to start this app programmatically from within another app to get this working.
10-02-2009 04:08 AM
Does this help?
How To - Allow an application to restart itself
Article Number: DB-00551
http://www.blackberry.com/knowledgecenterpublic/li
10-05-2009 04:06 AM
This is a very interesting idea, indeed!
Will try and let you all know
10-05-2009 04:38 AM
10-05-2009 05:10 AM
All right, I confess: it was after midnight and I forgot to add extra argument in API call, hence did not make the test work.
So this IS THE WAY to restart app once and then let system care for subsequent restart if app exits !!!
Problem solved.
Here is the code of you main function, everything else will be your normal UI Application:
public static void main(String[] args)
{
if (args.length == 0)
{
// need autorestart
ApplicationDescriptor descr = ApplicationDescriptor.currentApplicationDescriptor
ApplicationDescriptor newDescr = new ApplicationDescriptor(descr, descr.getName(), new String[] { "auto" },
descr.getIcon(), descr.getPosition(), descr.getNameResourceBundle(), descr.getNameResourceId(),
ApplicationDescriptor.FLAG_AUTO_RESTART);
ApplicationManager.getApplicationManager().schedu
System.currentTimeMillis() + 60001, true);
System.exit(0);
return;
}
AutoRestartApp app = new AutoRestartApp();
app.enterEventDispatcher();
}
10-05-2009 05:13 AM
10-05-2009 07:17 PM
10-06-2009 12:40 AM
I neither know how to "cancel" autorestart feature nor I know how to run the app immediately.
It is strange that BB has added some interesting features but did not provided good support for them. To my mind - the auto-restart feature is actually useless. Imagine you created an application with start at system startup and autorestart - it will never, ever shut down ! ...
Bummer.