红米 k40 pro+ 的硬件信息
字段 | 含义 | 示例 | 用法 |
---|---|---|---|
Build.BRAND | 产品品牌 | Redmi | 通过这个字段可以获取到对用户有意义的手机厂商名称,例如Xiaomi,Meizu,Huawei等。 |
Build.MANUFACTURER | 产品制造商 | Xiaomi | 多数品牌会把这个字段的值设置成和Build.BRAND值是一样的,Google最初是想把这个字段留给生产手机的代工厂,但手机厂商把这个字段都填成了自己。 |
Build.PRODUCT | 整个产品的名称 | haydnpro | 通过产品型号可以区分不同品牌,也可以区分同一个品牌下不同的产品。 |
Build.BOARD | 主板型号 | haydn | 虽然含义上是主板型号,不过有些厂商把这个字段填成了产品型号,或者填一个笼统的型号,显然并不希望被别人获取到这个信息 |
Build.DEVICE | 设备型号 | haydn | |
Build.VERSION.RELEASE | Android release版本 | 11 | |
Build.VERSION.SDK | Android API版本(String类型) | 30 | 在 API 15 已经被弃用 |
Build.VERSION.SDK_INT | Android API版本(int类型) 一般使用这种来查看 SDK | 30 | |
Build.VERSION.CODENAME | 设备当前的系统开发代号,一般使用REL代替 | REL | |
Build.VERSION_CODES | 已公布的Android版本号 | BASE = 1 BASE_1_1 = 2 CUPCAKE = 3 CUR_DEVELOPMENT = 10000 DONUT = 4 ECLAIR = 5 ECLAIR_0_1 = 6 ECLAIR_MR1 = 7 FROYO = 8 GINGERBREAD = 9 GINGERBREAD_MR1 = 10 HONEYCOMB = 11 HONEYCOMB_MR1 = 12 HONEYCOMB_MR2 = 13 ICE_CREAM_SANDWICH = 14 ICE_CREAM_SANDWICH_MR1 = 15 JELLY_BEAN = 16 JELLY_BEAN_MR1 = 17 JELLY_BEAN_MR2 = 18 KITKAT = 19 KITKAT_WATCH = 20 LOLLIPOP = 21 LOLLIPOP_MR1 = 22 M = 23 N = 24 N_MR1 = 25 O = 26 O_MR1 = 27 P = 28 Q = 29 R = 30 |
Build.VERSION.SDK_INT >= Build.VERSION_CODES.N |
代码中调用示例:
Log.d("test", "Build.BRAND=" + Build.BRAND +
"\nBuild.MANUFACTURER=" + Build.MANUFACTURER +
"\nBuild.PRODUCT=" + Build.PRODUCT +
"\nBuild.BOARD=" + Build.BOARD +
"\nBuild.DEVICE=" + Build.DEVICE +
"\nBuild.VERSION.RELEASE=" + Build.VERSION.RELEASE +
"\nBuild.VERSION.SDK=" + Build.VERSION.SDK +
"\nBuild.VERSION.SDK_INT=" + Build.VERSION.SDK_INT);
网友评论