Created
March 26, 2018 20:05
-
-
Save jeffypooo/c2079d3833e266892dac5b65a9b021bb to your computer and use it in GitHub Desktop.
Android | Programmatically retrieve version name
This file contains 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
try { | |
PackageInfo pInfo = this.getPackageManager().getPackageInfo(getPackageName(), 0); | |
String version = pInfo.versionName; | |
} catch (PackageManager.NameNotFoundException e) { | |
e.printStackTrace(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment