android重启代码
16lz
2021-01-23
首先新建一个app然后添加
android:sharedUserId="android.uid.system"
再添加重启的权限
然后代码:
public void reboot(Context context){LogsUtil.i(TAG, " reboot");Intent i = new Intent(Intent.ACTION_REBOOT); i.putExtra("nowait", 1); i.putExtra("interval", 1); i.putExtra("window", 0); context.sendBroadcast(i);LogsUtil.i(TAG, " reboot over");}
详细代码和使用步骤详见地址 http://git.oschina.net/cuiran/Counter
更多相关文章
- android 发布正式版时用Gradle移除日志打印代码(添加混淆配置)
- [置顶] android studio 如何进行格式化代码 快捷键必备
- Android源码可行的下载步骤
- android纯Java代码写的addView弹窗(亲测可用,欢迎留言)
- 整理的Android多种控件步骤
- android 代码设置apn