androidxamarinshutdown

How to Shutdown android device in C# Xamarin


I have tried shutdown with this

Java.Lang.Runtime.GetRuntime().Exec(new String[] { "/system/xbin/su", "-c", "shutdown" });

and this

Intent i = new Intent("android.intent.action.ACTION_REQUEST_SHUTDOWN");
i.PutExtra("android.intent.extra.KEY_CONFIRM", true);
StartActivity(i);

Solution

  • Thank's all, i have read in another post

    i use this for shutdown imediatly

    Java.Lang.Runtime.GetRuntime().Exec(new String[] { "/system/xbin/su", "-c", "reboot -p" });