关机:
Intent shutdown = new Intent(Intent.ACTION_REQUEST_SHUTDOWN);  shutdown.putExtra(Intent.EXTRA_KEY_CONFIRM, false);  shutdown.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);  mContext.startActivity(shutdown);

重启:
Intent reboot = new Intent(Intent.ACTION_REBOOT);reboot.putExtra("nowait", 1);reboot.putExtra("interval", 1);reboot.putExtra("window", 0);sendBroadcast(reboot);

加上
<manifest xmlns:android="http://schemas.android.com/apk/res/android"    android:versionCode="1"    [color=red]android:sharedUserId="android.uid.system"[/color]    android:versionName="1.0">

更多相关文章

  1. Android为Notification加上一个进度条
  2. Android(安卓)面试之横竖屏切换的Activity生命周期
  3. Android判断网络状态
  4. Android关机流程解析
  5. Android(安卓)SDK无法更新怎么办
  6. 为TextView添加上下边框
  7. Android(安卓)tabhost让选中项加上背景图
  8. Android关机界面代码
  9. 【Android】adb 查看所有程序包名

随机推荐

  1. 好吧,又是两分钟看完一道投机取巧的算法题
  2. 小知识:什么是「欧几里得算法」
  3. 浅谈什么是图拓扑排序
  4. 【三分钟】买卖股票的最佳时机 II 的另类
  5. 面试官,我会写二分查找法!对,没有 bug 的那
  6. 来安装一个酷炫的 VS Code 主题更好的刷
  7. 两分钟看完一道投机取巧的算法题
  8. 【五分钟】看完一道有装逼解法的算法题
  9. 三分钟看完两道套数学公式的算法题
  10. 浅谈什么是分治算法