我想重新启动我试过的手机 try { Process proc = Runtime.getRuntime().exec(new String[] { "su", "-c", "reboot" }); proc.waitFor();} catch (Exception ex) { Log.i(TAG, "Could not reboot", ex);} 而且PowerManager看到我的编码,但设
try {
Process proc = Runtime.getRuntime().exec(new String[] { "su", "-c", "reboot" });
proc.waitFor();
} catch (Exception ex) {
Log.i(TAG, "Could not reboot", ex);
}
而且PowerManager看到我的编码,但设备没有重新启动,在编码中请给出工作代码
ok = (Button)findViewById(R.id.button1);
final PowerManager power = (PowerManager)getSystemService(Context.POWER_SERVICE);
ok.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
power.reboot("fav");
}
});
You cannot do a reboot from an ordinary SDK application. Only
applications signed with the system firmware signing key can do this.
复制了这个答案,Programmatically switching off Android phone
