1

I want to reboot my phone using my app,but it requires root .

is there anyway to do it without root ?

My Code :

 try {
        Runtime.getRuntime().exec(new String[]{"su","-c","reboot now"});
    } catch (IOException e) {
        e.printStackTrace();
    }

Edit : i've heard that we can reboot phone without root using
'devicepolicymanager' . but i can't understand the official documentation , if anyone knows it please leave a demo code.

General Grievance
  • 4,555
  • 31
  • 31
  • 45
cife
  • 21
  • 2
  • 1
    Does this answer your question? [Restart android device programmatically](https://stackoverflow.com/questions/32984849/restart-android-device-programmatically) – Zydnar Dec 28 '19 at 11:41
  • The answer is in your question: **NO**. `Runtime.getRuntime().exec(new String[]{"su","-c","reboot now"});` You have to run **su**, which is only accessible when you root your device. – Phantômaxx Dec 28 '19 at 13:24
  • i've tried your given link before and it's not work on unrooted phones. – cife Dec 29 '19 at 07:11

1 Answers1

1

As far as I know you need root privileges to achieve this behavior.

McSlinPlay
  • 449
  • 2
  • 13