Skip to content

Instantly share code, notes, and snippets.

@erfanegtfi
Created April 13, 2018 11:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erfanegtfi/1bfef7cead5b28ff97aff912d5b2c79f to your computer and use it in GitHub Desktop.
Save erfanegtfi/1bfef7cead5b28ff97aff912d5b2c79f to your computer and use it in GitHub Desktop.
getAppVersionName
public static String getAppVersionName() {
try {
return MyApplication.getContext().getPackageManager().getPackageInfo(MyApplication.getContext().getPackageName(), 0).versionName;
} catch (Exception ex) {
ex.printStackTrace();
return "1";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment