0

I am trying to reboot Android device through a activity. I'm using following code.

public void reboot(){
    PowerManager pm=(PowerManager)getSystemService(Context.Power_Service);
    pm.reboot(null)
}

And I have given Manifest permission too.

android:name="android.permission.REBOOT

Error::java.lang.SecurityException: Neither user 10098 nor current process has android.permission.REBOOT.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Lakshay Jain
  • 446
  • 1
  • 3
  • 17

1 Answers1

0

Only applications signed with the system firmware signing key are allowed to do these operations.

More information can be found in the links below

How to compile Android Application with system permissions

Programmatically switching off Android phone

Community
  • 1
  • 1
Mayur Kaul
  • 703
  • 5
  • 12
  • What about https://developer.android.com/reference/android/app/admin/DevicePolicyManager#reboot(android.content.ComponentName) DevicePolicyManager API? You can set your app as device admin without root, but device owner (not firmware signer) needs to do it. – TCD Sep 22 '21 at 21:02