Created
October 26, 2020 10:28
-
-
Save maggocnx/d52fd1d0d8034a4059b3b2ebdd979a08 to your computer and use it in GitHub Desktop.
updating os
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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