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({
bizType:'AppletPG',
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:
Attributes | Type | Mandatory | Description |
authType | String | Yes | Identifier of the permission under guide, used to identify the type of the permission (such as LBS) |
Supported authType
Permission name | Permission code | Supported platform |
Background keep-alive permission | BACKGROUNDER | Android |
Desktop shortcut permission | SHORTCUT | Android |
Microphone permission | MICROPHONE | iOS |
Addressbook permission | ADDRESSBOOK | iOS |
Camera permission | CAMERA | iOS |
Photo permission | PHOTO | iOS |
Push notification bar permission | NOTIFICATION | Android |
Self-start permission | SELFSTARTING | Android |
Lbs switch | LBSSERVICE | iOS |
Lbs switch (app) | LBS | iOS |