-
-
Save benloong/3cb0575b4c6d704c47cb to your computer and use it in GitHub Desktop.
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 static int getVersionCode(Context ctx) { | |
int versionCode = 0; | |
try { | |
PackageInfo pInfo = ctx.getPackageManager().getPackageInfo( | |
ctx.getPackageName(), 0); | |
versionCode = pInfo.versionCode; | |
} catch (PackageManager.NameNotFoundException e) { | |
e.printStackTrace(); | |
} | |
return versionCode; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment