0

I want to restart android device using code in Xamarin. I have read many threads and found one with the following code:

try
{
    PowerManager pm = (PowerManager)GetSystemService(Context.PowerService);
    pm.Reboot(null);
}
catch (Exception ex)
{
}

and I modified my Manifest file like below, to get System level access:

<uses-permission android:name="android.permission.REBOOT" />
<application android:sharedUserId="android.uid.system" android:label="Appname" android:icon="@drawable/Icon"></application>

But I am getting the following exception in the result:

Java.Lang.SecurityException: Neither user 10523 nor current process has android.permission.REBOOT.

Community
  • 1
  • 1
Asim Khan
  • 572
  • 6
  • 34

1 Answers1

0

android.permission.REBOOT is "Not for use by third-party applications." Please refer to REBOOT of Manifest.permission.

And currently there is no way to reboot device programmatically without Rooting.

Elvis Xia - MSFT
  • 10,801
  • 1
  • 13
  • 24