随笔博文

Android获取系统信息-android.os.Build类

2023-10-25 14:02:30 michael007js 458

android.os.Build类是一个非常方便使用的类,不需要任何权限。

说明如下:

android.os.Build.BOARD:获取设备基板名称

android.os.Build.BOOTLOADER:获取设备引导程序版本号

android.os.Build.BRAND:获取设备品牌

android.os.Build.CPU_ABI:获取设备指令集名称(CPU的类型)

android.os.Build.CPU_ABI2:获取第二个指令集名称

android.os.Build.DEVICE:获取设备驱动名称

android.os.Build.DISPLAY:获取设备显示的版本包(在系统设置中显示为版本号)和ID一样

android.os.Build.FINGERPRINT:设备的唯一标识。由设备的多个信息拼接合成

android.os.Build.HARDWARE:设备硬件名称,一般和基板名称一样(BOARD)

android.os.Build.HOST:设备主机地址

android.os.Build.ID:设备版本号

android.os.Build.MODEL:获取手机的型号 设备名称。如:SM-N9100(三星Note4)

android.os.Build.MANUFACTURER:获取设备制造商。如:samsung android:os.Build.PRODUCT:产品的名称

android:os.Build.RADIO:无线电固件版本号,通常是不可用的 显示 unknown

android.os.Build.TAGS:设备标签。如release-keys或测试的test-keys android.os.Build.TIME:时间

android.os.Build.TYPE:设备版本类型主要为”user” 或”eng”

android.os.Build.USER:设备用户名 基本上都为android-build

android.os.Build.VERSION.RELEASE:获取系统版本字符串

android.os.Build.VERSION.CODENAME:设备当前的系统开发代号,一般使用REL代替

android.os.Build.VERSION.INCREMENTAL:系统源代码控制值,一个数字或者git哈希值

android.os.Build.VERSION.SDK:系统的API级别,推荐使用下面的SDK_INT来查看

android.os.Build.VERSION.SDK_INT:系统的API级别,int数值类型

android.os.Build.VERSION_CODES类:包含所有已公布的Android版本号,全部为int常量

android-27下的Build.java的源码:

package android.os;

public class Build {
 public static final String BOARD = null;
 public static final String BOOTLOADER = null;
 public static final String BRAND = null;
 /** @deprecated */
 @Deprecated
 public static final String CPU_ABI = null;
 /** @deprecated */
 @Deprecated
 public static final String CPU_ABI2 = null;
 public static final String DEVICE = null;
 public static final String DISPLAY = null;
 public static final String FINGERPRINT = null;
 public static final String HARDWARE = null;
 public static final String HOST = null;
 public static final String ID = null;
 public static final String MANUFACTURER = null;
 public static final String MODEL = null;
 public static final String PRODUCT = null;
 /** @deprecated */
 @Deprecated
 public static final String RADIO = null;
 /** @deprecated */
 @Deprecated
 public static final String SERIAL = null;
 public static final String[] SUPPORTED_32_BIT_ABIS = null;
 public static final String[] SUPPORTED_64_BIT_ABIS = null;
 public static final String[] SUPPORTED_ABIS = null;
 public static final String TAGS = null;
 public static final long TIME = 0L;
 public static final String TYPE = null;
 public static final String UNKNOWN = "unknown";
 public static final String USER = null;

 public Build() {
     throw new RuntimeException("Stub!");
 }

 public static String getSerial() {
     throw new RuntimeException("Stub!");
 }

 public static String getRadioVersion() {
     throw new RuntimeException("Stub!");
 }

 public static class VERSION_CODES {
     public static final int BASE = 1;
     public static final int BASE_1_1 = 2;
     public static final int CUPCAKE = 3;
     public static final int CUR_DEVELOPMENT = 10000;
     public static final int DONUT = 4;
     public static final int ECLAIR = 5;
     public static final int ECLAIR_0_1 = 6;
     public static final int ECLAIR_MR1 = 7;
     public static final int FROYO = 8;
     public static final int GINGERBREAD = 9;
     public static final int GINGERBREAD_MR1 = 10;
     public static final int HONEYCOMB = 11;
     public static final int HONEYCOMB_MR1 = 12;
     public static final int HONEYCOMB_MR2 = 13;
     public static final int ICE_CREAM_SANDWICH = 14;
     public static final int ICE_CREAM_SANDWICH_MR1 = 15;
     public static final int JELLY_BEAN = 16;
     public static final int JELLY_BEAN_MR1 = 17;
     public static final int JELLY_BEAN_MR2 = 18;
     public static final int KITKAT = 19;
     public static final int KITKAT_WATCH = 20;
     public static final int LOLLIPOP = 21;
     public static final int LOLLIPOP_MR1 = 22;
     public static final int M = 23;
     public static final int N = 24;
     public static final int N_MR1 = 25;
     public static final int O = 26;
     public static final int O_MR1 = 27;

     public VERSION_CODES() {
         throw new RuntimeException("Stub!");
     }
 }

 public static class VERSION {
     public static final String BASE_OS = null;
     public static final String CODENAME = null;
     public static final String INCREMENTAL = null;
     public static final int PREVIEW_SDK_INT = 0;
     public static final String RELEASE = null;
     /** @deprecated */
     @Deprecated
     public static final String SDK = null;
     public static final int SDK_INT = 0;
     public static final String SECURITY_PATCH = null;

     public VERSION() {
         throw new RuntimeException("Stub!");
     }
 }
}


首页
关于博主
我的博客
搜索