首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

android兑现自动关机代码

2013-03-17 
android实现自动关机代码private void shutdown() {try {Process process Runtime.getRuntime().exec(s

android实现自动关机代码

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();}}
Note:手机必须获取Root权限!!!

热点排行