且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

以编程方式重启设备

更新时间:2023-12-04 16:17:55

您所需的权限与您的重新启动方法无关,因为您的方法需要带root权限的电话(带有su).要重新启动电话,请像您一样获得权限,但是请致电 PowerManager#reboot .

The permission you required is not related to your reboot method, as your method requires a rooted phone (with su). To reboot the phone, require the permission as you did, but call PowerManager#reboot.

PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
pm.reboot(null);