0
我正在嘗試構建一個ota updater應用程序,該應用程序會將您的設備重新啓動並恢復到/sdcard/updater/update.zip中的閃存位置。如何從Android中的應用程序恢復閃存zip?
我看到這個解決方案:solution
因此,這裏是我當前的代碼:
Runtime run = Runtime.getRuntime();
Process p = null;
String SDCARD = "/sdcard/updater/update.zip";
DataOutputStream out = null;
try{
p = run.exec("su");
out = new DataOutputStream(p.getOutputStream());
// out.writeBytes("echo 'install_zip(\""+ SDCARD+"\");'" +" > /cache/recovery/extendedcommand\n");
out.writeBytes("adb shell");
out.writeBytes("echo 'install_zip(\""+SDCARD+"\");' > /cache/recovery/extendedcommand");
out.writeBytes("reboot recovery\n"); // testing
out.flush();
}catch(Exception e){
Log.e("FLASH", "Unable to reboot into recovery mode:", e);
e.printStackTrace();
}
但對我來說,它只是重新啓動以恢復和什麼都不做。 請幫忙。
我正在使用TWRP最新版本。