Skip to content

Instantly share code, notes, and snippets.

@shriduttkothari
Created August 22, 2013 13:39
Show Gist options
  • Save shriduttkothari/6307289 to your computer and use it in GitHub Desktop.
Save shriduttkothari/6307289 to your computer and use it in GitHub Desktop.
On successful download of the update zip file from server we must verify the cryptographic signature of the downloaded update file, and then we can install it as follows: It will reboot the device in recovery mode, where recovery console will first verify the signature of the file then execute the updater script of that update zip file, which wi…
try {
File otafileloc = new File("/cache/update.zip");
// Verify the cryptographic signature before installing it.
RecoverySystem.verifyPackage(otafileloc, null, null);
// Reboots the device into recovery mode to install the update package.
RecoverySystem.installPackage(getApplicationContext(), otafileloc);
} catch (IOException e) {
e.printStackTrace();
} catch (GeneralSecurityException e) {
e.printStackTrace();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment