我想知道是否有一种方法来重新启动设备通过code。香港专业教育学院的尝试:
I would like to know if there is a way to reboot the device through code. Ive tried:
Intent i = new Intent(Intent.ACTION_REBOOT);
i.putExtra("nowait", 1);
i.putExtra("interval", 1);
i.putExtra("window", 0);
sendBroadcast(i);
和添加权限重启
,但它仍然不工作。
And added permissions for REBOOT
but it still doesnt work.
感谢
这似乎为我工作:
try {
Process proc = Runtime.getRuntime().exec(new String[] { "su", "-c", "reboot" });
proc.waitFor();
} catch (Exception ex) {
Log.i(TAG, "Could not reboot", ex);
}
上一篇:如何在Eclipse中创建一个新的AVD?创建一个、如何在、Eclipse、AVD
下一篇:我如何检索AsyncTasks doInBackground数据()?数据、AsyncTasks、doInBackground