Last active
December 18, 2015 16:59
-
-
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
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
| 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