08-11-2011 09:48 AM
Is it possible to detect when your BlackBerry has been reset or you've removed the battery?
Weird question, I know but it would be awesome if it's possible.
Solved! Go to Solution.
08-11-2011 09:50 AM
08-11-2011 09:55 AM
Not exactly what I want to do. Doesn't really answer my Q either.
08-11-2011 10:07 AM
08-11-2011 10:12 AM
Actually Simon's answer was correct if perhaps a little too brief for you.
Here is a little more.
The usual way would be to have your application autostart. Most people do this via an Alternate Entry. So they have a part of their application that autostarts and sets everything up, and another part that runs when the icon is pressed. How to do this is described here:
Be aware that an application is also autostarted on initial install. To detect the difference, you need to check, in your autostart application, that the device is 'inStartUp - see
ApplicationManager.inStartup().
Hopefully this is enough.
08-11-2011 10:26 AM
Basically, I have a persistant store for certain objects/variables that I use for "run once" case. In this case, ApplicationMenuItems, but the issue is that if you've rebooted your phone then the menu items need to be reregistered. At the point, my variable/flag is still set to show that the menu items have been registered and thus, will not register them again unless you remove and re-install the app ... o_O
08-11-2011 10:32 AM
Put variables that you want 'reset' in RuntimeStore - it is lost on device restart
08-11-2011 10:40 AM
I thought about that but would that not remove the variable on device restart instead of "reset" it?
08-11-2011 01:10 PM - edited 08-11-2011 01:52 PM
Yes, but I use that to mean 'reset'. In other words, at start-up time, if the RuntimeStore object is not present, the application knows the device has been restarted or the application is freshly installed.
08-11-2011 01:42 PM
Hi Dionysus,
yes you can detect battery pull or device restart , just make your application autostart and implement SystemListener in your application , you will get call on powerUp().