# 系统信息

# qq.getSystemInfoSync

# Object qq.getSystemInfoSync()

qq.getSystemInfo 的同步版本

# 返回值

# Object res
属性 类型 说明 最低版本
brand string 设备品牌
model string 设备型号
pixelRatio number 设备像素比
screenWidth number 屏幕宽度,单位dp
screenHeight number 屏幕高度,单位dp
windowWidth number 可使用窗口宽度,单位dp
windowHeight number 可使用窗口高度,单位dp
statusBarHeight number 状态栏的高度,单位dp
language string QQ设置的语言
version string QQ版本号
system string 操作系统及版本
platform string 客户端平台
AppPlatform string App平台,手机QQ为'qq'
isMobileSDK boolean 是否是QQ小游戏SDK。获取该属性为true时表明运行在非QQ环境,由于低版本没有该属性,建议使用时先判断if(info.isMobileSDK)。有部分接口只有QQ环境下支持,注意处理兼容逻辑。
fontSizeSetting number 用户字体大小(单位px)。以QQ客户端「我-设置-通用-字体大小」中的设置为准
SDKVersion string 客户端基础库版本
benchmarkLevel number 设备性能等级(仅Android小游戏)。取值为:-2 或 0(该设备无法运行小游戏),-1(性能未知),>=1(设备性能值,该值越高,设备性能越好,目前最高不到50)
albumAuthorized boolean 允许QQ使用相册的开关(仅 iOS 有效)
cameraAuthorized boolean 允许QQ使用摄像头的开关
locationAuthorized boolean 允许QQ使用定位的开关
microphoneAuthorized boolean 允许QQ使用麦克风的开关
notificationAuthorized boolean 允许QQ通知的开关(仅 iOS 有效)
notificationAlertAuthorized boolean 允许QQ通知带有提醒的开关(仅 iOS 有效)
notificationBadgeAuthorized boolean 允许QQ通知带有标记的开关(仅 iOS 有效)
notificationSoundAuthorized boolean 允许QQ通知带有声音的开关(仅 iOS 有效)
bluetoothEnabled boolean 蓝牙的系统开关
locationEnabled boolean 地理位置的系统开关
wifiEnabled boolean Wi-Fi 的系统开关
navbarPosition object 右上角胶囊位置 (仅Android小游戏)
safeArea Object 在竖屏正方向下的安全区域 1.17.0
# Object safeArea
属性 类型 说明
left number 安全区域左上角横坐标
right number 安全区域右下角横坐标
top number 安全区域左上角纵坐标
bottom number 安全区域右下角纵坐标
width number 安全区域的宽度,单位逻辑像素
height number 安全区域的高度,单位逻辑像素
# Object navbarPosition
属性 类型 说明
marginTop number 距离屏幕顶部的距离 单位px
navbarHeight number 胶囊的高度 单位px
marginRight number 距离屏幕右侧的距离 单位px
navbarWidth number 胶囊的宽度 单位px

# 示例代码

qq.getSystemInfo({
  success(res) {
    console.log(res.model)
    console.log(res.pixelRatio)
    console.log(res.windowWidth)
    console.log(res.windowHeight)
    console.log(res.language)
    console.log(res.version)
    console.log(res.platform)
  }
})
1
2
3
4
5
6
7
8
9
10
11
try {
  const res = qq.getSystemInfoSync()
  console.log(res.model)
  console.log(res.pixelRatio)
  console.log(res.windowWidth)
  console.log(res.windowHeight)
  console.log(res.language)
  console.log(res.version)
  console.log(res.platform)
} catch (e) {
  // Do something when catch error
}
1
2
3
4
5
6
7
8
9
10
11
12

# qq.getSystemInfo

# qq.getSystemInfo(Object object)

获取系统信息

# 参数

# Object object
属性 类型 默认值 必填 说明
success function 接口调用成功的回调函数
fail function 接口调用失败的回调函数
complete function 接口调用结束的回调函数(调用成功、失败都会执行)
# object.success 回调函数

参数

Object res

属性 类型 说明 最低版本
brand string 设备品牌
model string 设备型号
pixelRatio number 设备像素比
screenWidth number 屏幕宽度,单位dp
screenHeight number 屏幕高度,单位dp
windowWidth number 可使用窗口宽度,单位dp
windowHeight number 可使用窗口高度,单位dp
statusBarHeight number 状态栏的高度,单位dp
language string QQ设置的语言
version string QQ版本号
system string 操作系统及版本
platform string 客户端平台
fontSizeSetting number 用户字体大小(单位px)。以QQ客户端「我-设置-通用-字体大小」中的设置为准
SDKVersion string 客户端基础库版本
benchmarkLevel number 设备性能等级(仅Android小游戏)。取值为:-2 或 0(该设备无法运行小游戏),-1(性能未知),>=1(设备性能值,该值越高,设备性能越好,目前最高不到50)
albumAuthorized boolean 允许QQ使用相册的开关(仅 iOS 有效)
cameraAuthorized boolean 允许QQ使用摄像头的开关
locationAuthorized boolean 允许QQ使用定位的开关
microphoneAuthorized boolean 允许QQ使用麦克风的开关
notificationAuthorized boolean 允许QQ通知的开关(仅 iOS 有效)
notificationAlertAuthorized boolean 允许QQ通知带有提醒的开关(仅 iOS 有效)
notificationBadgeAuthorized boolean 允许QQ通知带有标记的开关(仅 iOS 有效)
notificationSoundAuthorized boolean 允许QQ通知带有声音的开关(仅 iOS 有效)
bluetoothEnabled boolean 蓝牙的系统开关
locationEnabled boolean 地理位置的系统开关
wifiEnabled boolean Wi-Fi 的系统开关
navbarPosition object 右上角胶囊位置 (仅Android小游戏)
safeArea Object 在竖屏正方向下的安全区域 1.17.0
# Object safeArea
属性 类型 说明
left number 安全区域左上角横坐标
right number 安全区域右下角横坐标
top number 安全区域左上角纵坐标
bottom number 安全区域右下角纵坐标
width number 安全区域的宽度,单位逻辑像素
height number 安全区域的高度,单位逻辑像素
# Object navbarPosition
属性 类型 说明
marginTop number 距离屏幕顶部的距离 单位px
navbarHeight number 胶囊的高度 单位px
marginRight number 距离屏幕右侧的距离 单位px
navbarWidth number 胶囊的宽度 单位px

# 示例代码

qq.getSystemInfo({
  success(res) {
    console.log(res.model)
    console.log(res.pixelRatio)
    console.log(res.windowWidth)
    console.log(res.windowHeight)
    console.log(res.language)
    console.log(res.version)
    console.log(res.platform)
  }
})
1
2
3
4
5
6
7
8
9
10
11
try {
  const res = qq.getSystemInfoSync()
  console.log(res.model)
  console.log(res.pixelRatio)
  console.log(res.windowWidth)
  console.log(res.windowHeight)
  console.log(res.language)
  console.log(res.version)
  console.log(res.platform)
} catch (e) {
  // Do something when catch error
}
1
2
3
4
5
6
7
8
9
10
11
12