Skip to content

Instantly share code, notes, and snippets.

@pilot51
Last active December 18, 2015 16:59
Show Gist options
  • Select an option

  • Save pilot51/5815599 to your computer and use it in GitHub Desktop.

Select an option

Save pilot51/5815599 to your computer and use it in GitHub Desktop.
Gets the build time of the Android app. Thanks to: http://stackoverflow.com/a/7608719/382130
String getBuildTime() throws NameNotFoundException, IOException {
ApplicationInfo ai = getPackageManager().getApplicationInfo(getPackageName(), 0);
ZipFile zf = new ZipFile(ai.sourceDir);
long time = zf.getEntry("classes.dex").getTime();
zf.close();
return new SimpleDateFormat("yyyy-MM-dd h:mm:ss a zzz").format(new Date(time));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment