Skip to content

Instantly share code, notes, and snippets.

@maggocnx
Created October 26, 2020 10:28
Show Gist options
  • Save maggocnx/d52fd1d0d8034a4059b3b2ebdd979a08 to your computer and use it in GitHub Desktop.
Save maggocnx/d52fd1d0d8034a4059b3b2ebdd979a08 to your computer and use it in GitHub Desktop.
updating os
public class Updater {
public void runUpdate(){
try {
File file = new File("/cache/recovery/command");
FileOutputStream f = new FileOutputStream(file);
f.write("--update_package=/data/download.zip".getBytes());
f.close();
}
catch (IOException e) {
Log.e("Exception", "File write failed: " + e.toString());
}
PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
pm.reboot("recovery");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment