uni.getDeviceInfo(options?)
获取设备信息
参数
GetDeviceInfoOptions 属性值
名称 | 类型 | 必备 | 默认值 | 描述 |
filter | Array<string> | 是 | - | 过滤字段的字符串数组,假如要获取指定字段,传入此数组。 |
返回值
GetDeviceInfoResult 属性值
名称 | 类型 | 必备 | 默认值 | 描述 |
brand | string | 否 | - | 设备品牌 |
deviceBrand | string | 否 | - | 设备品牌 |
deviceId | string | 否 | - | 设备 id 。由 uni-app 框架生成并存储,清空 Storage 会导致改变 |
model | string | 否 | - | 设备型号 |
deviceModel | string | 否 | - | 设备型号 |
deviceType | string | 否 | - | 设备类型phone、pad、pc |
deviceOrientation | string | 否 | - | 设备方向 竖屏 portrait、横屏 landscape |
devicePixelRatio | string | 否 | - | 设备像素比 |
system | string | 否 | - | 操作系统及版本 |
platform | string | 否 | - | 客户端平台 |
oaid | string | 否 | - | oaid标识 Android专有 |
isRoot | boolean | 否 | - | 是否root |
isSimulator | boolean | 否 | - | 是否是模拟器 |
isUSBDebugging | boolean | 否 | - | adb是否开启 |
idfa | string | 否 | - | idfa标识 iOS专有 |
GetDeviceInfoResult 兼容性
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
oaid | 5.0 | √ | √ | 9.0 | x | x |
isUSBDebugging | 5.0 | √ | √ | 9.0 | x | x |
idfa | 5.0 | x | x | 9.0 | √ | √ |
getDeviceInfo 兼容性
安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
参见
getDeviceInfo
通用类型
GeneralCallbackResult
名称 | 类型 | 必备 | 默认值 | 描述 |
errMsg | string | 是 | - | 错误信息 |