設備須要有root權限android
<uses-permission android:name="android.permission.SHUTDOWN" />
<application ... android:sharedUserId="android.uid.system"
Runtime.getRuntime().exec(arrayOf("su","-c","reboot "))//重啓 Runtime.getRuntime().exec(arrayOf("su", "-c", "reboot -p"))//關機