Reputation: 337
An earlier question on the subject explains that you can request a reboot with proper permissions, but that the OS may cancel it. I would like a Device Administration application on a rooted phone to perform a shutdown on e.g. maximum failed password attempts, rather than data wipe. Because this is a security issue, stronger guarantees about the shutdown/reboot than those provided by PowerManager would be nice.
Upvotes: 1
Views: 1767
Reputation: 40391
I answered it before here: Android 2.2: Reboot device programmatically
In short,
try {
Runtime.getRuntime().exec("su");
Runtime.getRuntime().exec("reboot");
} catch (IOException e) {
}
It is equivalent to do adb reboot
. Its effect is immediate.
Upvotes: 5