getSystemInfoSync()

版本要求:
BaseKit≥2.0.1@ray-js/ray≥0.3.23
支持平台:
iOSAndroid

描述

获取系统信息

参数

无

返回值

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

合法值

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

示例代码

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

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