09-20-2012 03:41 PM
Need some advice on how to do the following.
I have my java app, which updates the homescreen image everyday with Bing's image of the day. The UI of the app has an option to turn this automatic feature on and off. On exit of the app, it checks this setting, and if it is turned on it starts a background thread which works to update the homescreen. (There is a single application working all of this functionality. So no separate app working as the daemon.)
The problem arises on resetting the device, there is nothing to start the daemon since that is handled on exit of the app. So, I need to somehow configure the app so that on startup of device, it checks for that setting and if it is turned on it starts the background thread, if not, does nothing.
I hope I am being clear. So right away the "Auto-run on Startup" option in the application descriptor file popped out at me, but if I use that, what can I put in the app to check the value of the setting and where is this startup handled? Or am I thinking about this situation wrong?
Solved! Go to Solution.
09-20-2012 08:36 PM
Your solution is half way there.
You would need to set the auto-startup flag as true but you will also need to add flag in the persistent storage which will indicate the state of the automatic feature.
Once the application will load at start up, it will check the flag and continue accordingly.
Hope that helps,
09-21-2012 03:29 PM
Thanks for the reply. I sorta did what you explained (I think).
So i made an alternate entry point, and set it to auto-run on startup. Then in my main() method I checked for which entry was being used and then if its the startup one, I check the value of the setting. At that point I can start the app in the background and resume it as usual.
Still working out getting it to run in background with the autostart setting. Cause I need to initialize the UI and service, but all in the background.
09-21-2012 05:31 PM
If you only want the UI started, then you need only one entry point, with auto-start specified. Just make sure that the BlackBerry is fully started before you try anything:
And make sure you start in the background. Then clicking on the icon will bring you app to the foreground. You will need to make sure that when you close you app, instead of closing it, just put your app to the background.
Does that make sense?
09-22-2012 01:01 AM
Thank you so much, it worked perfectly!
It was exactly because of the 'premature intitialization' that was causing me errors.
It was an honor to accept your solution.