android代码重启 .

先上代码:

Intent intent = new Intent(Intent.ACTION_REBOOT);
intent.setAction(Intent.ACTION_REBOOT);
intent.putExtra("nowait", 1);
intent.putExtra("interval", 1);
intent.putExtra("window", 0);
sendBroadcast(intent);

这是在调用的地方,只需发送如上的广播。

在androidmanifest.xml文件中在根标签manifest中添加权限

android:sharedUserId="android.uid.system"

添加上面的权限后,要源码编译。

Android.mk文件中要添加

LOCAL_CERTIFICATE := platform
原文地址:https://www.cnblogs.com/feifei1010/p/2639692.html