Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get my application Version

Tags:

android

Can anyone tell me how to get applcation version in Android?

like image 568
nileshbirhade Avatar asked Jun 03 '11 06:06

nileshbirhade


People also ask

How do I find my app version?

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.

What is version code and version name?

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.

What is a app version number?

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.


2 Answers

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.

like image 119
Merlyn Morgan-Graham Avatar answered Oct 12 '22 23:10

Merlyn Morgan-Graham


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.

like image 36
Jimmy Ilenloa Avatar answered Oct 12 '22 22:10

Jimmy Ilenloa