Reputation: 109
In my application there's a function to reboot which works fine with any rooted device... until now.
My newest test device (Android 4.2) doesn't react in any way. But using the adb prompt with the same command does the trick.
First I determine if the device is rooted which returns true:
String[] places = {"/sbin/", "/system/bin/", "/system/xbin/", "/data/local/xbin/", "/data/local/bin/", "/system/sd/xbin/", "/system/bin/failsafe/", "/data/local/"};
for (String where : places) {
if (new File(where + "su").exists()) {
isDeviceRootedResult = true;
break;
}
}
After that i try to execute the command like this:
Process rebootProcess = null;
rebootProcess = Runtime.getRuntime().exec("su -c reboot now");
if (rebootProcess != null) rebootProcess.waitFor();
I don't see any output in my LogCat, no exceptions, no throw, nothing...
While the "same" adb command works fine:
adb.exe shell "su -c reboot now"
Upvotes: 0
Views: 900
Reputation: 1998
You cannot reboot your device programmatically if your device is not rooted! It;s a question of security. You probably don't have superuser rights
Upvotes: 1