我终于设法让重新启动代码工作。我使用了以下代码:
Runtime runtime = Runtime.getRuntime();
Process proc = null;
OutputStreamWriter osw = null;
StringBuilder sbstdOut = new StringBuilder();
StringBuilder sbstdErr = new StringBuilder();
String command="/system/bin/reboot";
try { // Run Script
proc = runtime.exec("su");
osw = new OutputStreamWriter(proc.getOutputStream());
osw.write(command);
osw.flush();
osw.close();
} catch (IOException ex) {
ex.printStackTrace();
} finally {
if (osw != null) {
try {
osw.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
try {
if (proc != null)
proc.waitFor();
} catch (InterruptedException e) {
e.printStackTrace();
}
sbstdOut.append(ReadBufferedReader(new InputStreamReader(proc
.getInputStream())));
sbstdErr.append(ReadBufferedReader(new InputStreamReader(proc
.getErrorStream())));
if (proc.exitValue() != 0) {
}
现在我想要一个将设备重新启动到恢复模式的代码。该应用程序将仅适用于三星 Galaxy S。我没有找到任何用于在恢复中重新启动的代码,有没有办法通过代码在恢复中重新启动?