# uni.getDeviceInfo()

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

# getDeviceInfo 兼容性

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 设备类型phonepadpc
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|否|-|
|设备 id 。由 uni-app 框架生成并存储,清空 Storage 会导致改变
| |deviceModel|string|否|-|
|设备型号
| |deviceType|string|否|-|
|设备类型phone、pad、pc
| |deviceOrientation|string|否|-|
|设备方向 竖屏 portrait、横屏 landscape
| |devicePixelRatio|number|否|-|
|设备像素比
| |system|string|否|-|
|操作系统及版本
| |platform|string|否|-|
|客户端平台
| |isRoot|boolean|否|-|
|是否root。iOS 为是否越狱
| |isUSBDebugging|boolean|否|-|
|adb是否开启
| |osName|string|否|-|
|系统名称
| |osVersion|string|否|-|
|操作系统版本。如 ios 版本,andriod 版本
| |osLanguage|string|否|-|
|操作系统语言
| |osTheme|string|否|-|
|操作系统主题
| |osAndroidAPILevel|number|否|-|
|Android 系统API库的版本。
| |osHarmonySDKAPIVersion|number|否|-|
|鸿蒙系统软件API版本
| |osHarmonyDisplayVersion|string|否|-|
|产品版本,关于本机信息内的软件版本
| |romName|string|否|-|
|rom 名称。Android 部分机型获取不到值。iOS 恒为 ios
| |romVersion|string|否|-|
|rom 版本号。Android 部分机型获取不到值。iOS 为操作系统版本号(同 osVersion)。
| |abi|string|否|-|
-
|应用(微信APP)二进制接口类型(仅 Android 支持)
| |benchmarkLevel|number|否|-|
-
|| |cpuType|string|否|-|
-
|需要基础库: 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
| |isSimulator|boolean|否|-|
|是否是模拟器
已废弃,由于合规问题在4.51版本后不会采集传感器信息,会影响准确度,建议使用isSimulator()代替。| |model|string|否|-|
|设备型号 已废弃,仅为了向下兼容保留| |brand|string|否|-|
|设备品牌 已废弃,仅为了向下兼容保留|

Tips

  • deviceIdandroid 平台 根据优先使用imei、mac,如果没有获取到就使用随机生成的标识。ios 平台 是直接使用随机生成的标识