An Interest In:
Web News this Week
- March 22, 2024
- March 21, 2024
- March 20, 2024
- March 19, 2024
- March 18, 2024
- March 17, 2024
- March 16, 2024
April 18, 2022 10:53 am GMT
Original Link: https://dev.to/gaurawkumartechstern/restart-android-device-android-51-7hl
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:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To