How does android APP versions work?

Asked

Viewed 291 times

4

I wonder if the version of the Android APP is I who define in XML by TextView same, or has something you have to do to generate that number.

1 answer

1


It is you who defines the version number of your application. In the file Androidmanifest.xml, at the tag itself <manifest> has the properties android:versionCode and android:versionName. Whenever you submit a new version of your app to be published on Play Store you need to change these values.

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

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

Has a documentation that better describes these two properties and even recommendations on how to use them. If you want to display within your application the version name for your user in a TextView as you mentioned, it is possible to 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();
}
  • Thank you very much, it helped a lot :) .

Browser other questions tagged

You are not signed in. Login or sign up in order to post.