Created
September 8, 2015 07:20
-
-
Save chrisjyoon/a8e24bd6d98c1850285c to your computer and use it in GitHub Desktop.
android: get version info
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 String getVersion(Context context) { | |
| try { | |
| return context.getPackageManager() | |
| .getPackageInfo(context.getPackageName(), 0).versionName; | |
| } catch (PackageManager.NameNotFoundException e) { | |
| e.printStackTrace(); | |
| return ""; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment