For AI agents: the complete documentation index is available at /apps-plugin/docs/llms.txt, the full documentation bundle is available at /apps-plugin/docs/llms-full.txt, and this page is available as Markdown at /apps-plugin/docs/js-api/basic/system/getSystemSetting.md.

getSystemSetting

获取设备设置。

扫码预览

扫码预览 getSystemSetting

支持版本

前端库版本不低于 0.0.25。

支持平台

平台支持情况
Android支持
iOS支持
PC不支持
HarmonyOS不支持

支持场景

场景支持情况
页面支持
卡片支持

调用方式

同步 API

getSystemSetting(params?: object): GetSystemSettingResult

入参

无。

调用示例

import { getSystemSetting } from '@doubao-dev/framework/api';

const result = getSystemSetting();

console.log(result.bluetoothEnabled, result.locationEnabled);
console.log(result.wifiEnabled, result.deviceOrientation);

返回值

名称类型必返说明
bluetoothEnabledboolean是蓝牙的系统开关
deviceOrientationDeviceOrientation是设备方向
locationEnabledboolean是地理位置的系统开关
wifiEnabledboolean是Wi-Fi 的系统开关

返回示例

{
  "bluetoothEnabled": true,
  "locationEnabled": true,
  "wifiEnabled": true,
  "deviceOrientation": "portrait"
}

错误处理

同步调用失败时抛出错误。错误对象和通用错误码见 通用错误处理。

错误码

通用错误码

errNoerrMsg说明平台
102internal error内部错误Android

平台差异

  • Android:wifiEnabled 表示系统 Wi-Fi 开关是否打开
  • iOS:wifiEnabled 表示当前是否正在通过 Wi-Fi 联网