12-12-2008 01:45 PM - edited 12-12-2008 04:10 PM
I'm assuming that the QuickPull application is doing something else to trigger a reset, since simply calling a Device.restart(); isn't possible.
Can someone please tell me what are the conditions that will trigger a soft reset?
I've noticed that when uninstalling applications that sometimes a reset is required. I'm assuming that's because the module being uninstalled is still running.
12-13-2008 12:55 AM
04-11-2009 04:43 AM
03-03-2010 01:24 AM
Have used CodeModuleGroup and CodeModuleManager to create a cod programmatically and uninstall after running it. The device gets rebooted 100% times on all OS versions.
03-04-2010 11:56 AM
Could you post some/all of the code for the rest of us so we don't have to go thru the pain no our own...
Considering the interest in this subject - why doesn't BB simply expose the API to do this?
08-16-2010 02:19 AM
It don't works on BB 8900 curve. Any ideas?
08-16-2010 04:35 AM
The process documented should work. Do you want to show us your code so we can check it?
08-16-2010 05:34 AM
This is my dummy class:
import net.rim.device.api.system.Application;
public class Restart extends Application {
public static void main(String[] args) {
new Restart().enterEventDispatcher();
}
}
and restart method:
private void restart() {
try {
byte[] cod = IOUtilities.streamToBytes(getClass()
.getResourceAsStream("restart.cod"));
// create new module
CodeModuleGroup cmGroup = new CodeModuleGroup("RestartApp");
int newHandle = CodeModuleManager.createNewModule(cod.length, cod,
cod.length);
if (newHandle != 0) {
int savecode = CodeModuleManager.saveNewModule(newHandle, true);
if (savecode == CodeModuleManager.CMM_OK_MODULE_OVERWRITTEN)
cmGroup.addModule("restart");
cmGroup.store();
int[] hand = CodeModuleManager.getModuleHandles();
int handleForDelete = 0;
for (int i = 0; i < hand.length; i++) {
if (CodeModuleManager.getModuleName(hand[i]).equals(
"restart")) {
handleForDelete = hand[i];
break;
}
}
ApplicationDescriptor appDesc[] = CodeModuleManager
.getApplicationDescriptors(handleForDelete);
ApplicationManager.getApplicationManager().runApp
appDesc[0], false);
CodeModuleManager.deleteModuleEx(handleForDelete, true);
}
if (CodeModuleManager.isResetRequired())
CodeModuleManager.promptForResetIfRequired();
} catch (Exception e) {
e.printStackTrace()
}
}
08-16-2010 08:32 AM
Code looks OK, I will have a test later.
Is Restart marked as a System module and auto-started?
08-16-2010 08:45 AM
Not, Restart is not system module or auto-started.