In my android application, I wanna restart my android device on button click. But its working in rooted Phone,but not in un rooted phone.
try {
Runtime.getRuntime().exec(new String[]{"su","-c","reboot now"}));
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
Is it possible to reboot both rooted & unrooted android devices?
Unless something has changed recently you cannot reboot a non-rooted phone programatically, from a regular application.
You can do it if the application is signed by the system firmware key (which a regular application won't be).
If you do go the rooted device route, then be aware that the runtime exec function has some characteristics that mean it may not always behave as you expect.
Rather than learning this the hard way there is an excellent summary here: http://www.javaworld.com/article/2071275/core-java/when-runtime-exec---won-t.html