How do android APP versions work?

4

I would like to know if the Android APP version is the one I define in XML by TextView itself, or there is something you have to do to generate that number.

    
asked by anonymous 02.12.2014 / 14:41

1 answer

1

You define the version number of your application. In the AndroidManifest.xml file, the <manifest> tag itself has the android:versionCode and android:versionName properties. Whenever you submit a new version of your app to be published to the Play Store you need to change these values.

android:versionCode is any integer, but you need to make sure that with each version this number will be larger than the previous version. We usually start with the number 1 and increase with each new version. This value is not shown to the user in the store.

android:versionName is a string that represents the version of your application and will be displayed to the user in the store.

You have a documentation that best describes these two properties and even recommendations on how to use them. If you want to display the version name for your user in a TextView as you mentioned in your app, you can use the code below to get this value:

String versionName = null;

try {
    versionName = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName;
} catch (NameNotFoundException e) {
    e.printStackTrace();
}
    
02.12.2014 / 15:11