Skip to content

Instantly share code, notes, and snippets.

@harshabhadra
Created October 13, 2019 14:36
Show Gist options
  • Save harshabhadra/2555e2ff1b33a21b8663d2a98d59d006 to your computer and use it in GitHub Desktop.
Save harshabhadra/2555e2ff1b33a21b8663d2a98d59d006 to your computer and use it in GitHub Desktop.
//Get the version name
private String getVersionName(Context context) {
PackageInfo pInfo = null;
try {
pInfo = context.getPackageManager().getPackageInfo(getPackageName(), 0);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return pInfo.versionName;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment