android 实现关机

来源:互联网 发布:盘古推算软件源 编辑:程序博客网 时间:2024/05/16 02:21
private void shutdown() {
try {
Process process = Runtime.getRuntime().exec("su");
DataOutputStream out = new DataOutputStream(
process.getOutputStream());
out.writeBytes("reboot -p\n");
out.writeBytes("exit\n");
out.flush();
} catch (IOException e) {
e.printStackTrace();
}

}

root权限

测试 通过 环境 2.3.6 天宇小黄蜂

原创粉丝点击