I would like to know if there is a way to reboot the device through code. Ive tried:
Intent i = new Intent(Intent.ACTION_REBOOT);
i.putExtra("nowait", 1);
i.putExtra("interval", 1);
i.putExtra("window", 0);
sendBroadcast(i);
And added permissions for REBOOT
but it still doesnt work.
Thanks
You could possibly use the PowerManager to make it reboot (this does not guarantee that it'll reboot - OS may cancel it): links
link #2
I am using Xamarin. For me the solution is:
Still for rooted devices, but in case you want safer (process.waitFor() is conditioned, in separate try-catch, we have proper exception handling, "now" added in command after reboot, which is necessary for some devices, etc.) and maybe cleaner code, take a look at this:
This seemed to work for me:
If the phone is rooted, it's actually very simple:
The first command will ask for superuser permission. The second, will reboot the phone. There is no need for extra permissions in the manifest file since the actual rebooting is handled by the executed comamand, not the app.
Here is a solution. Remember, the device must be rooted.