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/openSetting.md.

openSetting

打开应用插件授权设置页面

扫码预览

扫码预览 openSetting

支持版本

前端库版本不低于 0.0.39。

支持平台

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

支持场景

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

接入准备

前置条件

  • 无额外前置条件,不要求在用户点击事件中调用

使用说明

该接口不要求在用户点击事件中调用。 JavaScript 调用方也不要传入 withSubscriptions: true,否则豆包会返回 subscription templates are not supported yet。

  • 设置页只能修改当前应用插件的 scope,不承载 HealthKit 系统权限设置。
  • 豆包当前不支持订阅模板,不要传入 withSubscriptions: true。

调用方式

异步 API

openSetting(params?: OpenSettingOptions): Promise<OpenSettingResult>

入参

名称类型必填默认值约束说明
withSubscriptionsfalse否false豆包 Android、iOS 当前不支持订阅模板,仅支持 false是否同时获取用户订阅消息的订阅状态;当前仅支持 false。

调用示例

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

try {
  const result = await openSetting();
  console.log(result.authSetting['scope.userLocation']);
} catch (error) {
  console.error(error);
}

成功返回

名称类型必返说明
authSettingAuthSetting是用户授权结果,key 为权限 scope,value 表示是否已授权
subscriptionsSettingSubscriptionsSetting否预留的订阅消息设置字段。豆包当前仅支持 `withSubscriptions: false`,因此不会返回该字段。
subscriptionsSetting.itemSettingsRecord<string, SubscriptionSettingStatus>否一次性订阅消息模板的订阅状态
subscriptionsSetting.mainSwitchboolean否设置页订阅消息总开关
subscriptionsSetting.templateSettingsRecord<string, SubscriptionTemplateSetting>否模板订阅状态

返回示例

{
  "authSetting": {
    "scope.userLocation": true,
    "scope.record": false
  }
}