android.os.Build 常用常量

在做项目的时候,经常需要采集一些设备信息,但又不经常用,所以有时候会查询需求满足的接口是哪个,所以周末就针对此整理了一下

Build.ID; //Either a changelist number, or a label like "M4-rc20".
Build.DISPLAY; //A build ID string meant for displaying to the user(设置-关于手机-版本号)
Build.PRODUCT; //The name of the overall product.(整个产品的名称)
Build.DEVICE; //The name of the industrial design.(工业设计名称--设备名称)
Build.BOARD; //The name of the underlying board, like "goldfish".(主板名称)
Build.MANUFACTURER; //The manufacturer of the product/hardware.(硬件制造商)
Build.BRAND; //The consumer-visible brand with which the product/hardware will be associated, if any.(设备品牌)
Build.MODEL; //The end-user-visible name for the end product.(终端用户可见的设备型号)
Build.BOOTLOADER; //The system bootloader version number.(系统程序的版本号)
Build.HARDWARE; // The name of the hardware (from the kernel command line or /proc).(硬件名称)
Build.SERIAL; // A hardware serial number, if available.Alphanumeric only, case-insensitive.(硬件序列号)
Build.TYPE; //The type of build, like "user" or "eng".(设备版本类型)
Build.TAGS; //Comma-separated tags describing the build, like "unsigned,debug".(设备标签,未签名/测试)
/** A string that uniquely identifies this build.  Do not attempt to parse this value.
         * 设备唯一标示,是由build的多个设备信息拼接而成
         * getString("ro.product.brand") + '/' +//BRAND
         * getString("ro.product.name") + '/' +//PRODUCT
         * getString("ro.product.device") + ':' +//DEVICE
         * getString("ro.build.version.release") + '/' +//VERSION.RELEASE
         * getString("ro.build.id") + '/' +//ID
         * getString("ro.build.version.incremental") + ':' +//VERSION.INCREMENTAL
         * getString("ro.build.type") + '/' +//TYPE
         * getString("ro.build.tags")
         * */
Build.FINGERPRINT;

// The following properties only make sense for internal engineering builds.
//主要for工程师调试版本
Build.HOST;
Build.USER;
Build.TIME;

Build.VERSION.INCREMENTAL; //The internal value used by the underlying source control to represent this build.E.g., a perforce changelist number or a git hash.
Build.VERSION.SDK_INT; //The user-visible SDK version of the framework;
  * its possible  values are defined in {
  @link Build.VERSION_CODES}.
Build.VERSION.CODENAME //The current development codename, or the string "REL" if this is a release build.
Build.VERSION.RELEASE; //The user-visible version string.  E.g., "1.0" or "3.4b5". (Android SDK version)
Build.VERSION.BASE_OS; //The base OS build the product is based on.

补充,Build.TYPE返回结果表示:

user表示用户版,有限的访问权限,适合product环境;adb默认是关闭的
userdebug,和user类似,具有root和debug权限;
eng 表示工程师版, 可调试;adb默认是打开的

看英文描述有时候并不能确定返回的值是否满足自己的需求,故针对此写了测试用例,查看了返回结果,针对结果看描述就会更清楚其表达

key google nexus5 小米6 原生系统 小米3 MIUI系统
android.os.Build#ID M4B30Z OPR1.170623.027 MMB29M
  • 2
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值