设备信息
设备信息
导入模块
import device from '@system.device'
接口定义
getInfo
获取设备的基本信息。返回对象的属性字段含义为:
brand
:设备的品牌名。manufacturer
:设备生产商。model
:设备型号。product
:设备代号。osType
:操作系统名称。osVersionName
:操作系统版本名称。brand
:设备的品牌名。brand
:设备的品牌名。brand
:设备的品牌名。
getId
批量获取设备标识信息,参数 types
指定需要获取的信息类别,是一个由 'device'
、'mac'
、'user'
或 'advertising'
元素构成的 Array 对象。根据 types
值的不同,返回对象的属性各字段含义为:
type
: 。device
: 设备唯一标识,仅当types
包含'device'
元素时存在。mac
: 设备的 MAC 地址,仅当types
包含'mac'
元素时存在。user
: 用户唯一标识,仅当types
包含'user'
元素时存在。advertising
: 广告唯一标识,仅当types
包含'advertising'
元素时存在。
getDeviceId
获取设备唯一标识。
getSerial
获取设备序列号。
getTotalStorage
获取存储空间的总大小。
getAvailableStorage
获取存储空间的可用大小。
screenWidth
设备的屏幕宽度,单位为像素。
screenHeight
设备的屏幕高度,单位为像素。
screenDensity
设备的屏幕像素密度,单位为 。
screenShape
设备的屏幕形状,值的含义如下:
'rect'
: 设备具有矩形屏幕。'circle'
: 设备具有圆形屏幕。
memoryProfile
获取设备的内存配置文件属性。这个属性是 memory-profile
媒体查询属性的 JavaScript API 版本,具体请参考媒体查询属性的文档。
与 memory-profile
媒体查询属性不同,memoryProfile
属性的值是一个整数,单位固定为 。