Android app version code and name

Source: Internet
Author: User

 Android:versioncode and Android:versionname differences

The version of Android can be defined in Androidmainfest.xml,

Mainly Android:versioncode and Android:versionname.

    • Android:versioncode: Mainly used for version upgrades, is of type int, the first version is defined as 1 and incremented later, so as long as the value is judged to determine whether an upgrade is required, the value is not displayed to the user.
    • Android:versionname: This is the version number that we often describe, consisting of three parts <major>.<minor>.<point> the value is a string that can be displayed to the user.

There are two values for the version number, as in the following example

<?xml version= "1.0" encoding= "Utf-8"? ><manifest xmlns:android= "http://schemas.android.com/apk/res/ Android "    package=" com.xxx.xxx "    android:versioncode=" 2 "    android:versionname=" 1.1 ">

Versioncode is for the Device Program identification version (upgrade), must be a Interger value, Integer, on behalf of the app updated how many times

Versionname is for users to read, can write 1.1, 1.2 and so on version

    Private String Getversionname () throws exception{          // Get instance           of Packagemanager Packagemanager Packagemanager = Getpackagemanager ();           // Getpackagename () is the package name of your current class, and 0 means to get  version information        0 );           return packinfo.versionname;           }

Android app version code and name

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.