Can anyone tell me how to get applcation version in Android?
Once in Settings, tap Apps and notifications (or your phone manufacturer's name it). When you're in there, tap See all xyz apps (where xyz is the number of apps you have installed). Now scroll down until you find the app you want to find the version for. Then tap it in the list.
The version code is an incremental integer value that represents the version of the application code. The version name is a string value that represents the “friendly” version name displayed to the users.
The app version that displays in the app store, and it is the first number that is displayed in MobileFirst Quality Assurance. In Android, this number is the versionName. In iOS, this number is the CFBundleShortVersionString. For example, if the version that is displayed is 1.4 (1.0), the release version number is 1.4.
This page has a tips on how to do it from java:
PackageManager manager = context.getPackageManager(); PackageInfo info = manager.getPackageInfo( context.getPackageName(), 0); String version = info.versionName;
Also, this link has official information on how to properly set up your application versioning.
I am using Android Studio, I realized I could use one line code to get this.
/*version name*/ BuildConfig.VERSION_NAME /*version code*/ BuildConfig.VERSION_CODE
Edited:
If you are using other android libraries, make sure you import BuildConfig from your application package. This is similar to the automatically generated R class for identifying resources.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With