HarmonyOS 打开应用权限设置页onOpenSetting的API是什么?

怎么通过api打开应用权限设置页,不用FunctionalButton

阅读 455
1 个回答

可以使用二次申请授权接口,通过调用requestPermissionOnSetting()直接拉起权限设置弹框,引导用户授予权限

https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/request-user-authorization-second-V5

Button("系统通知设置页").onClick(()=> {
  let context = getContext(this) as common.UIAbilityContext;
  let want: Want = {
    bundleName: 'com.huawei.hmos.settings',
    abilityName: 'com.huawei.hmos.settings.MainAbility',
    uri: "'application_info_entry",
    parameters: {
      pushParams: { bundleName: "" } // 应用包名
    }
  }
  context.startAbility(want)
})
logo
HarmonyOS
子站问答
访问
宣传栏