Skip to content

qin.getSystemSetting ​

获取设备设置

平台差异说明

H5微信小程序小红书小程序抖音小程序快手小程序
x基础库 (2.20.1+)xxx

返回参数说明

属性类型说明
bluetoothEnabledboolean蓝牙的系统开关。当值为 false 时, App 端:有可能是配置不正确导致,此时会返回 bluetoothError 属性描述错误。
bluetoothErrorStringApp 端: Android 平台没有权限或者 iOS 平台模块配置错误时返回字符串,否则不返回此属性。详情见下
locationEnabledboolean地理位置的系统开关。当值为 false 时, App 端:Android 平台是准确的; iOS 平台有可能是配置不正确导致,此时会返回 locationError 属性描述错误.
locationErrorStringApp 端: Android 平台不返回此属性; iOS 平台模块配置错误时返回字符串,否则不返回此属性。详情见下
wifiEnabledbooleanWi-Fi 的系统开关
wifiErrorStringApp 端: Android 平台没有权限时返回此属性; iOS 平台不返回此属性。详情见下
deviceOrientationstring设备方向。竖屏: portrait,横屏: landscape

注意

  • bluetoothError:
    • Android平台值为 "Missing permissions required by BluetoothAdapter.isEnabled: android.permission.BLUETOOTH" 表示没有 android.permission.BLUETOOTH 权限
    • iOS平台值为 "Missing bluetooth module in manifest.json" ,表示没有在 manifest.json -> App模块配置 中配置 BlueTooth(低功耗蓝牙) 模块
  • locationError:
    • Android平台不会返回此值;
    • iOS平台值为 "Missing geolocation module in manifest.json" 表示没有在 manifest.json -> App模块配置 中配置 Geolocation(定位) 模块
  • wifiError
    • Android平台值为 "Missing permissions required by WifiManager.isWifiEnabled: android.permission.ACCESS_WIFI_STATE" 表示没有 android.permission.ACCESS_WIFI_STATE 权限
    • iOS平台不会返回此值;

示例

js
const systemSetting = qin.getSystemSetting();

console.log(systemSetting.bluetoothEnabled);
console.log(systemSetting.deviceOrientation);
console.log(systemSetting.locationEnabled);
console.log(systemSetting.wifiEnabled);
const systemSetting = qin.getSystemSetting();

console.log(systemSetting.bluetoothEnabled);
console.log(systemSetting.deviceOrientation);
console.log(systemSetting.locationEnabled);
console.log(systemSetting.wifiEnabled);