dlt.getSystemInfoAsync
简介
异步获取系统信息。
使用限制
基础库从 4.0.0 或更高版本支持。
参数
Object object
| 属性 | 类型 | 默认值 | 必填 | 说明 |
|---|---|---|---|---|
| success | function | 否 | 接口调用成功的回调函数 | |
| fail | function | 否 | 接口调用失败的回调函数 | |
| complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
object.success 回调函数
参数
Object res
| 属性 | 类型 | 说明 |
|---|---|---|
| success | string | true-获取成功 |
| model | string | 手机型号。 |
| pixelRatio | number | 设备像素比。 |
| windowWidth | number | 窗口宽度。单位:dp |
| windowHeight | number | 窗口高度。单位:dp |
| language | string | 设置的语言。遵循 ISO 639 规范。 |
| frameworkversion | string | 小程序基础库版本号 |
| storage | string | 设备磁盘容量。 |
| currentBattery | string | 当前电量百分比。 |
| system | string | 系统版本。 |
| platform | string | 系统名:Android,iOS / iPhone OS 。 |
| screenWidth | number | 屏幕宽度。单位:px |
| screenHeight | number | 屏幕高度。单位:px |
| brand | string | 手机品牌。 |
| packageName | string | packageName |
| gaid | string | 宿主设备 ID |
| country | string | 国家 |
| mcc | string | 国家码 |
| capsuleHeight | number | 胶囊体高度。单位:px |
| capsuleWidth | number | 胶囊体宽度。单位:px |
| capsuleTranslationY | number | 胶囊体纵向偏移量。单位:px |
| capsuleTranslationX | number | 胶囊体横向偏移量。单位:px |
| statusBarHeight | number | 状态栏高度。单位:px |
object.fail 回调函数
参数
Object res
| 属性 | 类型 | 说明 |
|---|---|---|
| success | string | false-失败失败 |
示例代码
// pages/index/index.js
Page({
getSystemInfoAsync() {
dlt.getSystemInfoAsync({
success: (res) => {
console.log("systemInfo: ", res);
},
});
},
});