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
Developer
peter_strange
Posts: 19,607
Registered: ‎07-14-2008
My Device: Not Specified

Re: Detect a "battery pull" or phone reset

I might be wrong, but I think you will find that powerUp is also called when the phone has been put into standby.  Give it a try and see. 

Please use plain text.
Contributor
gaurav_dhingra
Posts: 28
Registered: ‎03-15-2011
My Device: 9700

Re: Detect a "battery pull" or phone reset

hi peter,

 

powerUp() is Invoked when the internal battery state has changed .

Please use plain text.
Developer
peter_strange
Posts: 19,607
Registered: ‎07-14-2008
My Device: Not Specified

Re: Detect a "battery pull" or phone reset

"powerUp() is Invoked when the internal battery state has changed ."

 

Don't think this is a true, certainly it is not what the API says.

 

But in this case, the OP wants a method to detect complete reset or battery pull, both of which will remove ApplicationMenuItems.  powerUp is called on return from the device entering standby, for example when the user presses the powerOff icon, and then presses the appropriate button to bring the device back to life.  This 'powerOff/PowerUp will not have cleared the ApplicationMenuItems.  So powerUp is unfortunately not an appropriate place to detect a system reset or battery pull. 

Please use plain text.
Contributor
gaurav_dhingra
Posts: 28
Registered: ‎03-15-2011
My Device: 9700

Re: Detect a "battery pull" or phone reset

Hi peter,

 

I have checked it, It is not called when device go to StandBy mode.

you also can check the same.

Please use plain text.
Developer
Dionysus
Posts: 152
Registered: ‎07-28-2011
My Device: Bold 9900

Re: Detect a "battery pull" or phone reset

I've added the variable/flag to the runtime store as peter suggested and made some code changes and it's working great thanks.

 

Topic solved and reply "liked" on previous page ^_^

Please use plain text.
Developer
peter_strange
Posts: 19,607
Registered: ‎07-14-2008
My Device: Not Specified

Re: Detect a "battery pull" or phone reset

[ Edited ]

@OP - great, glad that worked for you. 

 

@gaurav_dhingra - I suggest you check again.  Just for clarity, powerUp is not called when going into standby, that is when powerOff is called.  What I said was "powerUp is called on return from the device entering standby".  At that time ApplicationMenuItems are not removed. 

 

So I suggest powerUp itself is not an appropriate place to detect reset or battery pull.  Not because it doesn't get called, but because it is called in other circumstances. 

 

If you check and find something different, feel free to PM me with the details of your testing so that I can replicate it. 

Please use plain text.