Skip to content

Instantly share code, notes, and snippets.

@jeffypooo
Created March 26, 2018 20:05
Show Gist options
  • Save jeffypooo/c2079d3833e266892dac5b65a9b021bb to your computer and use it in GitHub Desktop.
Save jeffypooo/c2079d3833e266892dac5b65a9b021bb to your computer and use it in GitHub Desktop.
Android | Programmatically retrieve version name
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