Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
April 18, 2022 10:53 am GMT

Restart android device android 5.1

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


Original Link: https://dev.to/gaurawkumartechstern/restart-android-device-android-51-7hl

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To