Android Build类的详解及简单实例
一、类结构:
java.lang.Object ? android.os.Build
二、类概述:从系统属性中提取设备硬件和版本信息。
三、内部类:
1、Build.VERSION 各种版本字符串
2、Build.VERSION_CODES 目前已知的版本代码的枚举类
四、常量:UNKNOWN 当一个版本属性不知道时所设定的值。其字符串值为 unknown .
五、构造方法: Build ()
六、静态属性
1、BOARD 主板:The name of the underlying board, like goldfish.
2、BOOTLOADER 系统启动程序版本号:The system bootloader version number.
3、BRAND 系统定制商:The consumer-visible brand with which the product/hardware will be associated, if any.
4、CPU_ABI cpu指令集:The name of the instruction set (CPU type + ABI convention) of native code.
5、CPU_ABI2 cpu指令集2:The name of the second instruction set (CPU type + ABI convention) of native code.
6、DEVICE 设备参数:The name of the industrial design.
7、DISPLAY 显示屏参数:A build ID string meant for displaying to the user
8、FINGERPRINT 唯一识别码:A string that uniquely identifies this build. Do not attempt to parse this value.
9、HARDWARE 硬件名称:The name of the hardware (from the kernel command line or /proc).
10、HOST
11、ID 修订版本列表:Either a changelist number, or a label like M4-rc20.
12、MANUFACTURER 硬件制造商:The manufacturer of the product/hardware.
13、MODEL 版本即最终用户可见的名称:The end-user-visible name for the end product.
14、PRODUCT 整个产品的名称:The name of the overall product.
15、RADIO 无线电固件版本:The radio firmware version number. 在API14后已过时。使用getRadioVersion()代替。
16、SERIAL 硬件序列号:A hardware serial number, if available. Alphanumeric only, case-insensitive.
17、TAGS 描述build的标签,如未签名,debug等等。:Comma-separated tags describing the build, like unsigned,debug.
18、TIME
19、TYPE build的类型:The type of build, like user or eng.
20、USER
七、公共方法:
public static String getRadioVersion() 获取无线电固件版本
八、测试示例:
public static String getDeviceInfo() { StringBuffer sb = new StringBuffer(); sb.append("主板: "+ Build.BOARD+"\n"); sb.append("系统启动程序版本号: " + Build.BOOTLOADER+"\n"); sb.append("系统定制商:" + Build.BRAND+"\n"); sb.append("cpu指令集: " + Build.CPU_ABI+"\n"); sb.append("cpu指令集2 "+ Build.CPU_ABI2+"\n"); sb.append("设置参数: "+ Build.DEVICE+"\n"); sb.append("显示屏参数:" + Build.DISPLAY+"\n"); sb.append("无线电固件版本:" + Build.getRadioVersion()+"\n"); sb.append("硬件识别码:" + Build.FINGERPRINT+"\n"); sb.append("硬件名称:" + Build.HARDWARE+"\n"); sb.append("HOST: " + Build.HOST+"\n"); sb.append("修订版本列表:" + Build.ID+"\n"); sb.append("硬件制造商:" + Build.MANUFACTURER+"\n"); sb.append("版本:" + Build.MODEL+"\n"); sb.append("硬件序列号:" + Build.SERIAL+"\n"); sb.append("手机制造商:" + Build.PRODUCT+"\n"); sb.append("描述Build的标签:" + Build.TAGS+"\n"); sb.append("TIME: " + Build.TIME+"\n"); sb.append("builder类型:" + Build.TYPE+"\n"); sb.append("USER: " + Build.USER+"\n"); return sb.toString(); }
如有疑问请留言或者到本站社区交流讨论,感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。