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
New Developer
Posts: 12
Registered: ‎08-29-2008
My Device: Not Specified

Programmatically rebooting the device

I was hoping to accomplish this by injecting the alt-shift-del key combination. 

After some research I came to know that it is not possible to inject such combination.

 

Is there any other way to reset the device programatically?

Developer
Posts: 52
Registered: ‎07-17-2008
My Device: Not Specified

Re: Programmatically rebooting the device

Have you looked at

 

Device.requestPowerOff( true )

 

New Developer
Posts: 12
Registered: ‎08-29-2008
My Device: Not Specified

Re: Programmatically rebooting the device

I can use that API as a last resort.

 

But I am really looking for a way to soft-reset the device.

 

Anybody?

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Programmatically rebooting the device

I picked up the following code from someone on the Old forum, sorry don't remember who so can't give them credit. 

 

Not sure why I have commented out the request to POWER_ON.  I've not looked at the code in a year.  So this code, as supplied, might not work.  But I remember playing with it, and without much effort, I could get it to do a soft reset.  However this is NOT enough to install applications, so didn't do what I wanted.  But if all you want is a soft reset, then hopefully it will work for you.

 

public static final void powerCycle (int delayToPowerOn) { int timeDelay = 1000 * delayToPowerOn; ApplicationManager myMgr = ApplicationManager.getApplicationManager(); ApplicationDescriptor myDsc = ApplicationDescriptor.currentApplicationDescriptor(); // myMgr.setCurrentPowerOnBehavior(myDsc.POWER_ON); Date myDate = new Date(); myMgr.scheduleApplication(myDsc, myDate.getTime()+timeDelay, true); net.rim.device.api.system.Device.requestPowerOff( true); }

 

New Developer
Posts: 12
Registered: ‎08-29-2008
My Device: Not Specified

Re: Programmatically rebooting the device

Thanks very much for the code snippet.  Going to be very useful if I have to go with power recycle option.

 

I am still looking for a way to accomplish the equivalant of what happens when you press alt-shft-del  (ie soft reset)

Developer
Posts: 52
Registered: ‎07-17-2008
My Device: Not Specified

Re: Programmatically rebooting the device

^^ bump ^^

 

Is there a way to programmtically do the equivalant of pulling the battery?  I am looking for the kind of reboot that happens after reinstalling some apps.  Not the soft-reset (alt-caps-del).

 

 

Thanks in advance.

Retired
Posts: 36
Registered: ‎07-14-2008
My Device: Not Specified

Re: Programmatically rebooting the device

Use net.rim.device.api.system.CodeModuleManager.promptForResetIfRequired()
New Developer
Posts: 3
Registered: ‎12-04-2008
My Device: Not Specified

Re: Programmatically rebooting the device

Is there a programatic solution to execute a soft reset (alt+right shift + del)?
Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: Programmatically rebooting the device

Check the following classes to emulate soft reset key sequence:

 

net.rim.device.api.system.EventInjector
net.rim.device.api.system.EventInjector.KeyEvent

BlackBerry Development Advisor
Posts: 15,784
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Programmatically rebooting the device

[ Edited ]
The EventInjector can not be used to inject 3 simultaneous key presses (Alt+Cap+Del).  You can do 2 (Alt+Del or Cap+Del), but not three.
Message Edited by MSohm on 12-12-2008 01:36 PM
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker