getSystemInfo(params: Object)

版本要求:
BaseKit≥2.0.1@ray-js/ray≥0.3.23
支持平台:
iOSAndroid
import { getSystemInfo } from '@ray-js/ray';

// Promise 调用
try {
  const res = await getSystemInfo();
  console.log(res);
} catch (err) {
  console.log(err.errorMsg);
}

描述

获取系统信息

参数

属性类型必填说明
complete() => void否接口调用结束的回调函数(调用成功、失败都会执行)
success(params: Object) => void否接口调用成功的回调函数
fail(params: Object) => void否接口调用失败的回调函数
success 回调参数
属性类型说明BaseKit 最低版本
is24Hourboolean是否为 24 小时制v3.2.6
systemstring操作系统及版本v3.2.6
brandstring设备品牌v3.2.6
modelstring设备型号v3.2.6
platformstring系统类型,如 ios、android、harmonyv3.2.6
timezoneIdstring时区标识v3.2.6
pixelRationumber像素比v3.2.6
screenWidthnumber屏幕宽度,单位为逻辑像素,例如返回 411v3.2.6
screenHeightnumber屏幕高度,单位为逻辑像素,例如返回 914v3.2.6
windowWidthnumber窗口宽度,单位为逻辑像素,例如返回 411v3.2.6
windowHeightnumber窗口高度,单位为逻辑像素,例如返回 914v3.2.6
useableWindowWidthnumber可使用窗口宽度,单位为逻辑像素,例如返回 411v3.3.2
useableWindowHeightnumber可使用窗口高度,单位为逻辑像素,例如返回 814v3.3.2
statusBarHeightnumber状态栏高度,单位为逻辑像素,例如返回 34v3.2.6
languagestring当前语言v3.2.6
安全区域信息,字段单位为逻辑像素,例如返回 { left: 0, right: 411, top: 34, bottom: 898, width: 411, height: 864 }v3.2.6
albumAuthorizedboolean是否允许访问相册v3.2.6
cameraAuthorizedboolean是否允许访问摄像头v3.2.6
locationAuthorizedboolean是否允许访问定位v3.2.6
microphoneAuthorizedboolean是否允许访问麦克风v3.2.6
notificationAuthorizedboolean是否允许发送通知v3.2.6
notificationAlertAuthorizedboolean是否允许通知提醒v3.2.6
notificationBadgeAuthorizedboolean是否允许通知角标v3.2.6
notificationSoundAuthorizedboolean是否允许通知声音v3.2.6
bluetoothEnabledboolean蓝牙开关是否开启v3.2.6
locationEnabledboolean定位开关是否开启v3.2.6
wifiEnabledbooleanWi-Fi 开关是否开启v3.2.6
theme"dark" | "light"当前主题v3.2.6
deviceOrientation"portrait" | "landscape"当前屏幕方向v3.2.6
deviceLevelstring设备等级(低:low-中:middle-高:high)v3.3.3
isSupportPinShortcutboolean手机系统是否支持创建快捷方式(仅Android使用)v3.5.0
deviceTypestring设备类型 phone:手机 pad:平板v3.10.6
fail 回调参数
属性类型说明
errorMsgstring错误信息
errorCodestring | number错误码
错误扩展

返回值

无

合法值

success.params.theme
值说明BaseKit 最低版本
dark暗黑模式-
light亮色模式-
success.params.deviceOrientation
值说明BaseKit 最低版本
portrait竖屏-
landscape横屏-

示例代码

import { getSystemInfo } from '@ray-js/ray'

getSystemInfo({
  success: data => {
    console.log(data);
  },
  fail: error => {
    console.error(error);
  },
});