my.showAuthGuide
Pop up dialog for user in form of (image, text, etc.) via the permission guide module. To advice the user to turn on the related permission. The permission guide is used to advice rather than to validate the permission. The call timing is when the service party confirms the required permission is limited. In addition, the permission guide pop-up is subject to fatigue and other factors.
Sample Code
copy
// API-DEMO page/API/show-auth-guide/show-auth-guide.json
{
"defaultTitle": "Permission guide"
}
copy
<!-- API-DEMO page/API/show-auth-guide/show-auth-guide.axml-->
<view class="page">
<view class="page-description">Permission guide API</view>
<view class="page-section">
<view class="page-section-title">my.showAuthGuide</view>
<view class="page-section-demo">
<button type="primary" onTap="showAuthGuide">Permission guide</button>
</view>
</view>
</view>
copy
// API-DEMO page/API/show-auth-guide/show-auth-guide.js
Page({
showAuthGuide() {
my.showAuthGuide({
authType:'LBS',
success:(res)=>{
//When shown is true, it indicates the permission guide pop-up will be shown; when it is false, it indicates the user has allowed the permission.
my.alert({content: 'Call success: '+JSON.stringify(res), });
},
fail:(error)=>{
my.alert({content: 'Call failure:'+JSON.stringify(error), });
},
});
},
});
Parameters
String type with the following attributes:
Property | Type | Required | Description |
authType | String | Yes | Identifier of the permission under guide, used to identify the type of the permission (such as LBS). |
success | Function | No | Callback function upon call success. |
fail | Function | No | Callback function upon call failure. |
complete | Function | No | Callback function upon call completion (to be executed upon either call success or failure). |
Supported authType
Permission name | Permission code |
Microphone permission | MICROPHONE |
Addressbook permission | ADDRESSBOOK |
Camera permission | CAMERA |
Photo permission | PHOTO |
Lbs switch | LBS |