Thank you for visiting the BlackBerry Support Community Forums.
BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)
BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.
"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."
- Kevin Michaluk, Founder, CrackBerry.com
Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.
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.