我試圖以編程方式重啓我的Galaxy S3。我已經試過試圖以編程方式重啓根設備Android設備
事情:
try {
Process proc = Runtime.getRuntime().exec(new String[] { "su", "-c", "reboot" });
proc.waitFor();
} catch (Exception ex) {
Log.i("RebootActivity", "Could not reboot", ex);
}
try {
Runtime.getRuntime().exec(new String[]{"su","-c","reboot now"});
} catch (IOException e) {
e.printStackTrace();
}
try
{
Process process = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(process.getOutputStream());
os.writeBytes("reboot now\n");
}
catch (Throwable t)
{
t.printStackTrace();
}
你們是否有任何想法如何做到這一點?
謝謝。
如果我嘗試使用'/ system/bin/su',則會得到以下異常:java.io.IOException:運行exec()時發生錯誤。命令:[/ system/bin/su,-c,now now]工作目錄:null環境:null' – 2014-09-10 19:13:55
每次重新啓動模擬器時,必須輸入'「adb shell chmod 777/dev/tty <>」' (當然用您的串口設備替換/ dev/tty <>「) – 2014-09-10 19:26:49
@SagarPilkhwal,我沒有使用模擬器我正在使用Galaxy S3 4.4.2 – 2014-09-10 19:38:18