Android version 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, which is a string that can be displayed to the user.
There are two values for the version number, as in the following example
<span style= "FONT-SIZE:18PX;" ><?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 "> ... </span>
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
Extend another question: how do I read this value when the app needs to proofread the version?
1. Read Manifest.xml
<span style= "FONT-SIZE:18PX;" >packagemanager pm = Context.getpackagemanager ();//context is the current activity context packageinfo pi = Pm.getpackageinfo ( Context.getpackagename (), 0); version = Pi.versionname;</span>
Flowers Blossom Xiechun No matter, plumbing water cold fish know.
The difference, application and acquisition of Versioncode and Versionname