wx.getSystemInfo
wx.getSystemInfoAsync
获取系统信息,返回的 host 信息中的 appid 是多端应用资源包的 appid,并非小程序的 appid
Object object
属性 | 类型 | 默认值 | 必填 | 说明 |
---|
success | function | | 否 | 接口调用成功的回调函数 |
fail | function | | 否 | 接口调用失败的回调函数 |
complete | function | | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
object.success 回调函数参数
参数 | 类型 | 说明 |
---|
brand | string | 设备品牌 |
model | string | 设备型号 |
pixelRatio | number | 设备像素比 |
screenWidth | number | 屏幕宽度,单位px |
screenHeight | number | 屏幕高度,单位px |
windowWidth | number | 可使用窗口宽度,单位px |
windowHeight | number | 可使用窗口高度,单位px |
statusBarHeight | number | 状态栏的高度,单位px |
system | string | 操作系统及版本 |
platform | string | android 表示 Android App;ios表示iOS App |
SDKVersion | string | 基础库版本 |
benchmarkLevel | string | 设备性能等级 |
safeArea | Object | 在竖屏正方向下的安全区域 |
locationReducedAccuracy | boolean | true 表示模糊定位,false 表示精确定位,仅 iOS 支持 |
theme | string | 系统当前主题,取值为light 或dark ,全局配置"darkmode":true 时才能获取,否则为 undefined (不支持小游戏) |
host | Object | 当前应用运行的宿主环境 |
enableDebug | boolean | 是否已打开调试 |
deviceOrientation | string | 设备方向 |
errMsg | string | 错误信息,新增返回 |
abi | string | 新增返回,Android 设备的CPU类型 |
host
参数 | 类型 | 说明 |
---|
env | string | 运行环境,值为 "SAAASDK" |
appid | string | 多端应用的资源包 id (非多端应用 id) ,该 id 是不变的,该 id 和多端应用 id 是一对一关联的 |
version | string | SDK 版本串 |
bundleIdentifier | string | Bundle ID |
appVersion | string | App 应用版本 |
sdkVersion | string | SDK 版本 |
wx.getSystemInfoSync
返回内容同 wx.getSystemInfoAsync 的 object.success 的回调函数参数