Device
device模块提供了与设备有关的信息与操作,例如获取设备宽高,内存使用率,IMEI,调整设备亮度、音量等
此模块的部分函数,例如调整音量,需要"修改系统设置"的权限,如果没有该权限,会抛出
SecurityException
并跳转到权限设置界面目录
device.setBrightnessMode(mode)
device.getNotificationVolume()
device.getNotificationMaxVolume()
device.setNotificationVolume(volume)
device.keepScreenOn([timeout])
device.keepScreenDim([timeout])
device.width
- {number}
设备屏幕分辨率宽度,例如1080
device.height
- {number}
设备屏幕分辨率高度,例如1920
device.buildId
- {string}
Either a change list number, or a label like "M4-rc20".
修订版本号,或者诸如"M4-rc20"的标识
device.broad
- {string}
The name of the underlying board, like "goldfish".
设备的主板(?)型号
device.brand
- {string}
The consumer-visible brand with which the product/hardware will be associated, if any.
与产品或硬件相关的厂商品牌,如"Xiaomi", "Huawei"等
device.device
- {string}
The name of the industrial design.
设备在工业设计中的名称
device.model
- {string}
The end-user-visible name for the end product.
设备型号
device.product
- {string}
The name of the overall product.
整个产品的名称
device.bootloader
- {string}
The system bootloader version number.
设备Bootloader的版本
device.hardware
- {string}
The name of the hardware (from the kernel command line or /proc).
设备的硬件名称(来自内核命令行或者/proc)
device.fingerprint
- {string}
A string that uniquely identifies this build. Do not attempt to parse this value.
构建(build)的唯一标识码
device.serial
- {string}
A hardware serial number, if available. Alphanumeric only, case-insensitive.
硬件序列号
device.sdkInt
- {number}
The user-visible SDK version of the framework; its possible values are defined in Build.VERSION_CODES.
安卓系统API版本,例如安卓4.4的sdkInt为19
device.incremental
- {string}
The internal value used by the