This content originally appeared on DEV Community and was authored by gaurawkumartechstern
how to restart android device programmatically and I used below code for restart my device Process proc = null;
try {
//proc = Runtime.getRuntime().exec(new String[] { "su", "-c", "reboot" });
proc = Runtime.getRuntime().exec(new String[]{"/system/bin/su","-c","reboot now"});
proc.waitFor();
} catch (Exception ex) {
Log.i(TAG, "Could not reboot", ex);
}
And he is asking for a permission then i used this code
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
pm.reboot(null);
please help me and inform me it is possible or not and i need this only in android 5.1
This content originally appeared on DEV Community and was authored by gaurawkumartechstern
gaurawkumartechstern | Sciencx (2022-04-18T10:53:42+00:00) Restart android device android 5.1. Retrieved from https://www.scien.cx/2022/04/18/restart-android-device-android-5-1/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.