gpt4 book ai didi

android - 在 Recovery Android 中重启

转载 作者:行者123 更新时间:2023-11-29 22:21:18 27 4
gpt4 key购买 nike

我终于设法使重启代码正常工作。我使用了以下代码:

        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) {
}

现在我想要一个将设备重新启动到恢复模式的代码。该应用程序将仅适用于 Samsung Galaxy S。我没有找到任何用于在恢复中重启的代码,是否有任何方法可以通过代码在恢复中重启?

最佳答案

如果重启命令的版本及其在该设备上调用的后端支持它,则这可能有效:

String command="/system/bin/reboot recovery";

当然要意识到,在您使用 su 程序的那一刻,您正在使用不受支持的 android 修改。

关于android - 在 Recovery Android 中重启,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7111539/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com