08-16-2010 10:06 AM
I would mark it as auto-start. You need to do something that tells the Blackberry that it does need to restart. If you mark something as auto-start, then the BlackBerry will think that it has to restart to remove whatever that module does when auto-started.
08-16-2010 12:49 PM
Attached is a zip archive containing two JDE projects that show how to do this. One project just creates a cod file called com_samples_Restart. This should be placed in the directory for use by the RestartTest application.
The RestartTest Application installs the 'restart' cod, then removes it. Since com_sample_Restart is marked as auto-start, this will force a restart of the device.
You can test this on the Simulator. You should sign the sample_Restart cod, copy the signed one into the the directory for RestartTest, then compile and sign that before testing on a device. You only need RestartTest on the device.
It is not all sunshine. Because you are actually running com_sample_Restart it may ask if it can be trusted. In addition, the message that the user sees is not a nice 'do you want to restart' message. I hope someone can take this and make it a more useful implementation. But I guess it is better than nothing.
Thanks to osm for the providing the restart code!
08-17-2010 01:50 AM
Thanks, Peter !
I have run it on simulator and it works fine. Then i sign 'restart.cod' (marked as auto-run on startup), copied this cod to RestartTest directory, and then rebuilt and sign RestartTest.
I have grant all permissions for RestartTest (options->applications), and have mark 'restart.cod' as trusted application when it asked, but RestartTest does not work on device (curve 8900), after clicking 'Restart' menu it does nothing.
I think, may it depends from OS version of BlacBerry?
Simulator's OS version is 22.214.171.124
Device - 126.96.36.1991
08-17-2010 03:54 AM
Device restarting apps are as old as the BlackBerry OS is For OS 4.6 and below there was a simple hack (just a line of code), that restarts the device for sure. This was fixed in OS 4.7, so restart apps have to use the trick with dynamic install and delete of internal app, so the device is forced to show "Reboot Now/Reboot Later". So far so good.
However here comes OS 5.0 ... and the things are different again. There is something new - TrustedAppManager or something like this, which disables the trick, that worked so well in OS 4.7. Workarounds are different with different success (like sleeping for a while, install/reinstall of internal app, changing app permissions etc.) but none of them works at 100%. Afaik none of the restart solutions works on Bold 9700, no idea why, probably some tweak in the OS version.
No idea how the restart is working in OS 6.0 yet.
Well, to summarize - to find a restart solution, that works always, is a hard thing.
08-17-2010 04:25 AM
QuiteSimple - thanks for the info.
To OP, the problem is possibly that you are compiling in 4.7 and running in 4.6.1, since 4.6.1 was the original OS for the 8900. If you have upgraded to OS 5.0, then the problems highlighted by QuiteSimple will most certainly be the problem.
09-08-2010 03:16 AM
I found that if delete the used library, then will showing restart dialog.
In my project i have the library which calling when my app run. And i just reinstall this library to rebooting device.
Works on OS 188.8.131.521.