

English
Get basic device information
App | H5 | 微信小程序 | 支付宝小程序 | 抖音小程序 | 快手小程序 | QQ小程序 | 百度小程序 | 京东小程序 | 钉钉小程序 | 飞书小程序 | 元服务 |
---|---|---|---|---|---|---|---|---|---|---|---|
√ (3.4.13+) | √ (3.4.13+) | √ (2.20.1+) | x | x | x | x | x | x | x | x | x |
HarmonyOS |
---|
HBuilderX 4.23 |
Return parameter description
Parameter Name | Type | Description | Platform Difference Description |
---|---|---|---|
deviceBrand | string | The device brand. For example: apple , huawei | H5 does not support |
deviceId | string | The device id. Generated and stored by the uni-app framework, emptying the Storage will cause changes | |
deviceModel | string | Device Model | |
deviceType | string | 设备类型phone 、pad 、pc | |
deviceOrientation | string | 设备方向 竖屏 portrait 、横屏 landscape | App、H5 。微信小程序请使用 getSystemInfo Api 获取 |
devicePixelRatio | string | 设备像素比 | App、H5 。微信小程序请使用 getSystemInfo Api 获取 |
system | string | 操作系统及版本 | |
platform | string | 客户端平台 | |
osName | string | 系统名称 | HBuilderX 4.32+,weixin 4.33 支持 |
osVersion | string | 操作系统版本。如 ios 版本,andriod 版本 | HBuilderX 4.32+,weixin 4.33 支持 |
osLanguage | string | 操作系统语言 | HBuilderX 4.32+,H5、weixin 不支持 |
osTheme | string | 操作系统主题 | HBuilderX 4.32+,H5、weixin 不支持 |
romName | string | rom 名称。Android 部分机型获取不到值。iOS 恒为 ios | HBuilderX 4.32+,H5、weixin 不支持 |
romVersion | string | rom 版本号。Android 部分机型获取不到值。iOS 为操作系统版本号(同 osVersion ) | HBuilderX 4.32+,H5、weixin 不支持 |
applet special return parameters
Parameter Name | Type | Description | Platform Difference Description |
---|---|---|---|
abi | String | Application binary interface type (only supported by Android) | WeChat applet only |
benchmarkLevel | Number | Device performance level (Android only). The value is: -2 or 0 (the device cannot run mini games), -1 (the performance is unknown), >=1 (the device performance value, the higher the value, the better the device performance, the current maximum is less than 50) | WeChat applet only |
Deprecated return parameter, reserved for backward compatibility only
Parameter Name | Type | Description | Platform Difference Description |
---|---|---|---|
brand | string | device brand | H5 not supported |
model | string | Device model. The new model will display unknown after it has been launched for a while, and WeChat will adapt it as soon as possible. |
类型 |
---|
GetDeviceInfoResult |
|:-|:-|:-|:-|:-:|:-| |deviceBrand|string|否|-| | |deviceId|string|否|-| | |deviceModel|string|否|-| | |deviceType|string|否|-| | |deviceOrientation|string|否|-| | |devicePixelRatio|number|否|-| | |system|string|否|-| | |platform|string|否|-| | |isRoot|boolean|否|-| | |isUSBDebugging|boolean|否|-| | |osName|string|否|-| | |osVersion|string|否|-| | |osLanguage|string|否|-| | |osTheme|string|否|-| | |osAndroidAPILevel|number|否|-| | |osHarmonySDKAPIVersion|number|否|-| | |osHarmonyDisplayVersion|string|否|-| | |romName|string|否|-| ios | |romVersion|string|否|-| osVersion )。| |abi|string|否|-| - | |benchmarkLevel|number|否|-| - - 2.29.0 设备 CPU 型号(仅 Android 支持)(Tips: GPU 型号可通过 WebGLRenderingContext.getExtension('WEBGL_debug_renderer_info') 来获取) | |deviceAbi|string|否|-| - 2.25.1 设备二进制接口类型(仅 Android 支持) | |memorySize|string|否|-| - 2.30.0 设备内存大小,单位为 MB | | 已废弃,由于合规问题在4.51版本后不会采集传感器信息,会影响准确度,建议使用 isSimulator() 代替。|
| |
Tips
deviceId
:android 平台
根据优先使用imei、mac,如果没有获取到就使用随机生成的标识。ios 平台
是直接使用随机生成的标识