wx.getSystemInfo

wx.getSystemInfoAsync

获取系统信息,返回的 host 信息中的 appid 是多端应用资源包的 appid,并非小程序的 appid

Object object

属性类型默认值必填说明
successfunction接口调用成功的回调函数
failfunction接口调用失败的回调函数
completefunction接口调用结束的回调函数(调用成功、失败都会执行)

object.success 回调函数参数

参数类型说明
brandstring设备品牌
modelstring设备型号
pixelRationumber设备像素比
screenWidthnumber屏幕宽度,单位px
screenHeightnumber屏幕高度,单位px
windowWidthnumber可使用窗口宽度,单位px
windowHeightnumber可使用窗口高度,单位px
statusBarHeightnumber状态栏的高度,单位px
systemstring操作系统及版本
platformstringandroid 表示 Android App;ios表示iOS App
SDKVersionstring基础库版本
benchmarkLevelstring设备性能等级
safeAreaObject在竖屏正方向下的安全区域
locationReducedAccuracybooleantrue 表示模糊定位,false 表示精确定位,仅 iOS 支持
themestring系统当前主题,取值为lightdark,全局配置"darkmode":true时才能获取,否则为 undefined (不支持小游戏)
hostObject当前应用运行的宿主环境
enableDebugboolean是否已打开调试
deviceOrientationstring设备方向
errMsgstring错误信息,新增返回
abistring新增返回,Android 设备的CPU类型

host

参数类型说明
envstring运行环境,值为 "SAAASDK"
appidstring多端应用的资源包 id (非多端应用 id) ,该 id 是不变的,该 id 和多端应用 id 是一对一关联的
versionstringSDK 版本串
bundleIdentifierstringBundle ID
appVersionstringApp 应用版本
sdkVersionstringSDK 版本

wx.getSystemInfoSync

返回内容同 wx.getSystemInfoAsync 的 object.success 的回调函数参数