Back to Uni App

Open App Authorize Setting

docs/api/open-app-authorize-setting.md

2.3.36.8 KB
Original Source
<!-- ## uni.openAppAuthorizeSetting(options) @openappauthorizesetting -->

::: sourceCode

uni.openAppAuthorizeSetting(options) @openappauthorizesetting

GitCode: https://gitcode.com/dcloud/uni-api/tree/alpha/uni_modules/uni-openAppAuthorizeSetting

GitHub: https://github.com/dcloudio/uni-api/tree/alpha/uni_modules/uni-openAppAuthorizeSetting

:::

跳转系统授权管理页

openAppAuthorizeSetting 兼容性

Web微信小程序AndroidiOSiOS uni-app x UTS 插件HarmonyOSHarmonyOS(Vapor)
<a style="color:unset;" href="https://vote.dcloud.net.cn/#/?name=uni-app%20x">x</a>4.414.514.514.514.615.0

注:App平台其实早期版本也可以使用

参数

名称类型必填默认值兼容性描述
optionsOpenAppAuthorizeSettingOptions-Web: x; 微信小程序: -; Android: -; iOS: -; HarmonyOS: -

options 的属性描述

名称类型必备默认值兼容性描述
success(result: OpenAppAuthorizeSettingSuccess) => voidnullWeb: x; 微信小程序: -; Android: 4.51; iOS: 4.51; iOS uni-app x UTS 插件: 4.51; HarmonyOS: 4.61; HarmonyOS(Vapor): 5.0接口调用成功的回调函数
fail(result: OpenAppAuthorizeSettingFail) => voidnullWeb: x; 微信小程序: -; Android: 4.51; iOS: 4.51; iOS uni-app x UTS 插件: 4.51; HarmonyOS: 4.61; HarmonyOS(Vapor): 5.0接口调用失败的回调函数
complete(result: OpenAppAuthorizeSettingComplete) => voidnullWeb: x; 微信小程序: -; Android: 4.51; iOS: 4.51; iOS uni-app x UTS 插件: 4.51; HarmonyOS: 4.61; HarmonyOS(Vapor): 5.0接口调用结束的回调函数(调用成功、失败都会执行)

OpenAppAuthorizeSettingSuccess 的属性值 @openappauthorizesettingsuccess-values

名称类型必备默认值兼容性描述
errMsgstring-Web: x; 微信小程序: -; Android: 4.51; iOS: 4.51; iOS uni-app x UTS 插件: 4.51; HarmonyOS: 4.61; HarmonyOS(Vapor): 5.0错误信息

OpenAppAuthorizeSettingFail 的属性值 @openappauthorizesettingfail-values

名称类型必备默认值兼容性描述
errMsgstring-Web: x; 微信小程序: -; Android: 4.51; iOS: 4.51; iOS uni-app x UTS 插件: 4.51; HarmonyOS: 4.61; HarmonyOS(Vapor): 5.0错误信息

OpenAppAuthorizeSettingComplete 的属性值 @openappauthorizesettingcomplete-values

名称类型必备默认值兼容性描述
errMsgstring-Web: x; 微信小程序: -; Android: 4.51; iOS: 4.51; iOS uni-app x UTS 插件: 4.51; HarmonyOS: 4.61; HarmonyOS(Vapor): 5.0错误信息

示例

示例为hello uni-app x alpha分支,与最新HBuilderX Alpha版同步。与最新正式版同步的master分支示例另见

该 API 不支持 Web,请运行 hello uni-app x 到 App 平台体验

::: preview

appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/open-app-authorize-setting/open-app-authorize-setting

uvue
<template>
  <!-- #ifdef APP -->
  <scroll-view style="flex:1">
  <!-- #endif -->
    <button type="primary" style="margin: 20px;" @tap="go">跳转系统授权管理页</button>
  <!-- #ifdef APP -->
  </scroll-view>
  <!-- #endif -->
</template>

<script setup lang="uts">
  const go = () => {
    uni.openAppAuthorizeSetting({
      success (res) {
        console.log(res)
      }
    })
  }

  defineExpose({
    go
  })
</script>

<style>

</style>

:::

参见

示例

示例为hello uni-app x alpha分支,与最新HBuilderX Alpha版同步。与最新正式版同步的master分支示例另见

该 API 不支持 Web,请运行 hello uni-app x 到 App 平台体验

::: preview

appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/open-app-authorize-setting/open-app-authorize-setting

uvue
<template>
  <!-- #ifdef APP -->
  <scroll-view style="flex:1">
  <!-- #endif -->
    <button type="primary" style="margin: 20px;" @tap="go">跳转系统授权管理页</button>
  <!-- #ifdef APP -->
  </scroll-view>
  <!-- #endif -->
</template>

<script setup lang="uts">
  const go = () => {
    uni.openAppAuthorizeSetting({
      success (res) {
        console.log(res)
      }
    })
  }

  defineExpose({
    go
  })
</script>

<style>

</style>

:::

通用类型

GeneralCallbackResult

名称类型必备默认值兼容性描述
errMsgstring-Web: -; 微信小程序: 4.41; Android: -; iOS: -; HarmonyOS: -错误信息