欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

Android Build类的详解及简单实例

程序员文章站 2023-12-10 14:55:16
android build类的详解及简单实例 一、类结构: java.lang.object ? android.os.build 二、类概述:...

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(); 
  } 

如有疑问请留言或者到本站社区交流讨论,感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!