Install .zip In Clockwork From App?
So in my app Im trying to make it flash a .zip in clockwork recovery using this Runtime run = Runtime.getRuntime(); Process p = null;
Solution 1:
out.writeBytes("echo 'install_zip(\""+ SDCARD:" +clickedFile.toString()+"\");'"+" > /cache/recovery/extendedcommand\n");
adb
commands would look like:
adb shell
echo'install_zip("/sdcard/update.zip");' > /cache/recovery/extendedcommand
Solution 2:
I had the same issue but I was using a ListView combined with an ArrayAdapter to return the full path of the file. When I tried passing the path as 'SDCARD:' followed by the path to the file, it wasn't able to find the file as the method seems to be no longer supported by newer versions of CWM Recovery. I found an easy workaround though:
publicbooleaninstallPackage(String pos)throws InterruptedException {
finalStringlocation="/emmc/" + pos.substring(11);
Processprocess=null;
try {
process = Runtime.getRuntime().exec("su");
DataOutputStreamos=newDataOutputStream(process.getOutputStream());
os = newDataOutputStream(process.getOutputStream());
os.writeBytes("echo 'install_zip(\"" + location + "\");'" + " > /cache/recovery/extendedcommand\n");
os.writeBytes("reboot recovery\n");
os.writeBytes("exit\n");
os.flush();
return (process.waitFor() == 0);
} catch (IOException e) {
// TODO Auto-generated catch block
Log.e("FLASH:", "Unable to boot into recovery");
e.printStackTrace();
}
returnfalse;
}
Post a Comment for "Install .zip In Clockwork From App?"