1、使用AndroidManager来实现(我在项目中使用的此方法)
PowerManager pManager = (PowerManager) getSystemService(Context.POWER_SERVICE); pManager.reboot("重启");
2、发送reboot广播
Intent reBoot = new Intent(Intent.ACTION_REBOOT); reBoot.putExtra("nowait", 1); reBoot.putExtra("interval", 1); reBoot.putExtra("window", 0); sendBroadcast(reBoot);
3、实现系统重启的apk需要在AndroidManifest.xml中添加system的权限,运行后需要对apk重新签名一下。
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.***.***" android:sharedUserId="android.uid.system">