How to obtain Firmware version of Android programmatically?

拥有回忆 提交于 2020-01-15 05:05:31

问题


The following screenshot of a generic tablet shows an example of Firmware version:

We have tried pretty much everything of Android Build, none of them is the firmware version.


回答1:


Firmware is the operating software available on an Android device, and it is available in different versions designed by different manufacturers. Basically it's the device-specific part of the software. For example, you may have Android 4.2.2 running on your phone, but have a firmware number that looks completely different because it relates to more details than just Operating System. The firmware number consists of several elements, all of which are essential for the functioning of the phone:

PDA: Android operating system and your customizations. Phone: the actual identifier of your device. CSC (Country Exit Code): the languages and country-specific parameters. Bootloader: the boot loader program that runs at startup to all unit processes.

Software Build Version is basically the Firmware Version.

See android.os.Build.VERSION. SDK or SDK in contain the API version. android.os.Build.VERSION_CODES contains the relevant constants.

String deviceSoftwareVersion=telephonyManager.getDeviceSoftwareVersion();

Refer to this Build.VERSION

Procedure to use it in code.

if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD) {
     // only for gingerbread and newer versions
}

This can be also checked by through code

System.out.println("button press on device name = "+android.os.Build.MODEL +" brand = "+android.os.Build.BRAND +" OS version = "+android.os.Build.VERSION.RELEASE + " SDK version = " +android.os.Build.VERSION.SDK_INT);

UPDATE

Try this one -

  1. android.os.Build.FINGERPRINT
  2. android.os.Build.BOARD
  3. Build.HOST
  4. Build.ID
  1. Build.SERIAL

Check the following Code.

FINAL UPDATE

String mString = "";

    mString.concat("VERSION.RELEASE {" + Build.VERSION.RELEASE + "}");
    mString.concat("\nVERSION.INCREMENTAL {" + Build.VERSION.INCREMENTAL + "}");
    mString.concat("\nVERSION.SDK {" + Build.VERSION.SDK + "}");
    mString.concat("\nBOARD {" + Build.BOARD + "}");
    mString.concat("\nBRAND {" + Build.BRAND + "}");
    mString.concat("\nDEVICE {" + Build.DEVICE + "}");
    mString.concat("\nFINGERPRINT {" + Build.FINGERPRINT + "}");
    mString.concat("\nHOST {" + Build.HOST + "}");
    mString.concat("\nID {" + Build.ID + "}");

    ((TextView) findViewById(R.id.textView1)).setText(mString);

You can also useBuild.DISPLAY

A build ID string meant for displaying to the user



来源:https://stackoverflow.com/questions/40421604/how-to-obtain-firmware-version-of-android-programmatically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!