# getSystemInfo

异步方式获取系统信息。

# 支持说明

应用能力 Android iOS PC 预览效果
小程序 3.1.0 3.1.0 3.2.0
扫码预览
用BoosHi扫码或PC端点击
网页应用 3.3.0 3.3.0 待开发 待补充

# 输入

继承标准对象输入,无扩展属性

# 输出

继承标准对象输出

success返回对象的扩展属性:

名称 数据类型 描述
system string 操作系统版本
platform string 操作系统类型。iOS: ios, Android: android, PC: darwin/windows_nt( darwin代表Mac,windows_nt代表windows )
brand string 手机品牌。PC端值为PC
model string 手机型号。PC端均为PC
version string BossHi App版本号
移动端3.3.0支持
PC 3.4.0支持
SDKVersion string 客户端基础库版本
screenWidth number 屏幕宽度
screenHeight number 屏幕高度
windowWidth number 可使用窗口的宽度
windowHeight number 可使用窗口高度
pixelRatio number 设备像素比
statusBarHeight number 状态栏高度PC端:网页应用不支持
language string BossHi设置的语言
待开发
fontSizeSetting number 用户字体大小
待开发
appName string 宿主app名字
待开发
safeArea object 在竖屏正方向下的安全区域
PC端:网页应用不支持
  ∟ left number 安全区域左上角的横坐标
  ∟ right number 安全区域右上角的横坐标
  ∟ top number 安全区域左上角的纵坐标
  ∟ bottom number 安全区域左下角的纵坐标
  ∟ width number 安全区域的宽度
  ∟ height number 安全区域的高度
navigationBarSafeArea object 导航栏的安全区域坐标,当页面配置了自定义导航时返回,方便应用在该区域内进行自定义元素的布局
  ∟ left number 导航栏的安全区域左上角横坐标
  ∟ right number 导航栏的安全区域右上角的横坐标
  ∟ top number 导航栏的安全区域左上角的纵坐标
  ∟ bottom number 导航栏的安全区域右下角的纵坐标
  ∟ width number 导航栏的安全区域宽度
  ∟ height number 导航栏的安全区域高度
theme string 当前系统主题。在小程序支持 DarkMode的时候才会返回
待开发
示例值:light
可选值
light:浅色主题
dark:深色主题
网页应用:不支持

# 示例代码

bz.getSystemInfo({ 
    success(res) {
      console.log(JSON.stringify(res));
    },
    fail(res) {
      console.log(`getSystemInfo fail: ${JSON.stringify(res)}`);
    }
});
1
2
3
4
5
6
7
8

success返回对象示例:

{
  "errMsg": "getSystemInfo:ok",
  "system": "11.4.0",
  "platform": "darwin",
  "appName": "BossHi",
  "version": "5.1.0",
  "language": "zh_CN",
  "SDKVersion": "1.9.56",
  "screenWidth": 1322,
  "screenHeight": 913,
  "windowWidth": 1322,
  "windowHeight": 913,
  "pixelRatio": 2,
  "statusBarHeight": 0,
  "safeArea": {
    "left": 0,
    "right": 1322,
    "top": 0,
    "bottom": 913,
    "width": 1322,
    "height": 913
  },
  "navigationBarSafeArea": {
    "left": 0,
    "right": 1268,
    "top": 0,
    "bottom": 36,
    "width": 1268,
    "height": 36
  },
  "brand": "PC",
  "model": "PC",
  "fontSizeSetting": 12,
  "theme": "light"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
最后更新于 : 12/15/2022, 2:18:25 PM