关机:
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);
重启:
- Intentshutdown=newIntent(Intent.ACTION_REQUEST_SHUTDOWN);
- shutdown.putExtra(Intent.EXTRA_KEY_CONFIRM,false);
- shutdown.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- mContext.startActivity(shutdown);
重启:
- Intentreboot=newIntent(Intent.ACTION_REBOOT);
- reboot.putExtra("nowait",1);
- reboot.putExtra("interval",1);
- reboot.putExtra("window",0);
- sendBroadcast(reboot);