【问题标题】:How can I flash zip in recovery from an app in android?如何从 android 中的应用程序中刷新 zip 恢复?
【发布时间】:2014-08-30 23:04:20
【问题描述】:

我正在尝试构建一个 ota 更新程序应用程序,它将重新启动您的设备以恢复并刷新位于 /sdcard/updater/update.zip 中的 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 最新版本。

【问题讨论】:

    标签: java android root recovery


    【解决方案1】:

    根据本页:http://www.teamw.in/OpenRecoveryScript

    你需要改变你的

    /cache/recovery/extendedcommand
    

    /cache/recovery/openrecoveryscript
    

    【讨论】:

      【解决方案2】:

      我发现android.os.RecoverySystem.installPackage 函数可以做到这一点。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-01-07
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多