Gets the version number of the current app:
Private throws Exception { // get an instance of Packagemanager Packagemanager Packagemanager = Getpackagemanager (); // Getpackagename () is the package name of your current class, and 0 means to get version information PackageInfo packinfo = Packagemanager.getpackageinfo (Getpackagename (), 0); = packinfo.versionname; return version; }
Gets the version number of the current system:
Textview.settext ("Product Model:" + Android.os.Build.MODEL + "," + Android.os.Build.VERSION.SDK + ","
Or
/* * * Build.version_codes 1 (0x00000001) Android 1.0 BASE 2 (0x00000002) Android 1.1 base_1_1 3 (0x00000003) Android 1.5 cupcake 4 (0x000000 ) Android 1.6 Donut 5 (0x00000005) Android 2.0 Eclair 6 (0x000 00006) Android 2.0.1 eclair_0_1 7 (0x00000007) Android 2.1 eclair_mr1 8 (0x00000008) Android 2.2 FROYO 9 (0x00000009) Android 2.3 Gingerb READ (0x0000000a) Android 2.3.3 Gingerbread_mr1 (0x0000000b) Android 3.0 Honeycomb (0x0000000c) Android 3.1 honeycomb_mr1 (0x0000000d) Android 3.2 HONEYCOMB_MR2 (0x0000000e) Android 4.0 Ice_cream_sandwich 1 5 (0X0000000F)Android 4.0.3 ICE_CREAM_SANDWICH_MR1 (0x00000010) Android 4.1 Jelly_bean 1 7 (0x00000011) Android 4.2 jelly_bean_mr1 (0x00000012) Android 4.3 jel LY_BEAN_MR2 (0x00000013) Android 4.4 KITKAT*/ /*get the Android version number of the current system*/ intCurrentapiversion = Android.os.Build.VERSION.SDK_INT;