All Products
Search
Document Center

SuperApp:wv.getSetting

Last Updated:Feb 17, 2025

Obtains the user's authorization status for the current miniapp, used in conjunction with the wv.authorize interface.

Request parameters

The request parameters are of the Object type. The following table describes the parameters.

Parameter

Type

Required

Description

success

Function

No

The callback function for a successful query.

fail

Function

No

The callback function for a failed query.

Response parameters

The success callback function receives an object that consists of key-value pairs. In a key-value pair, the key is the scope of authorization and the value is a Boolean value that indicates whether the user grants the permissions within the scope. The following table describes the property of the object.

Property

Type

Description

authSetting

Object

The permissions that are granted by the user.

The following table describes the attributes of authSetting.

Attribute

Type

Description

location

Boolean

location: return false if not authorized, corresponding interfaceWVLocation.getLocation;WVLocation.searchLocation

camera

Boolean

camera: return false if not authorized, corresponding interface:WVScan.scan

bluetooth

Boolean

bluetooth: return false if not authorized, corresponding interface:WVBluetooth all methods

album

Boolean

album: return false if not authorized, corresponding interface:WVVideo.chooseVideo;WVCamera.takePhoto

contacts

Boolean

contacts: return false if not authorized, corresponding interface:WVContacts all methods

microphone

Boolean

microphone: return false if not authorized, corresponding interface:WVMotion.listenBlow;WVMotion.stopListenBlow

file

Boolean

file: return false if not authorized, corresponding interface:WVFile all methods WVVideo.saveVideoToPhotosAlbum;WVImage.saveImage

call

Boolean

call: return false if not authorized, corresponding interface:WVCall.dial;WVCall.call

vibrate

Boolean

vibrate: return false if not authorized, corresponding interface:WVMotion.vibrate

screen

Boolean

screen: return false if not authorized, corresponding interface:WVScreenCapture.capture

The fail callback function receives an object, the following table describes the error information:

Error information

Error Description

Solution

You need to configure the authorization switch to apply for authorization

Need to turn on the authorization switch

Check whether the authorization switch is opened

User not bound

Container need registration userid

Check the container registration user information

Sample code

window.WindVane.call('wv', 'getSetting', {}, function(res) {
    const { camera = false, location = false } = res.authSetting;
}, function(e) {
    alert('failure:' + JSON.stringify(e));
});