Permission JS API
Use Case
On Android, this parameter can be a comma separated value, e.g., "camera, record_audio, contacts". But on iOS, only one value can be specified. Follwing things can be passed in permission in following cases -
iOS:
camera, video, microphone, contacts, calendar, reminder, photos, location, speech,
Android:
camera, record_audio, read_phone_numbers, contacts, calendar, body_sensors, storage, location, get_accounts, read_phone_state.
Request Attributes
Content format: JSON
Parameter | Description | Required | Example Value |
---|---|---|---|
permission | Name of the native parameter for whom permission is required (Array of string for checking multiple parameter) | Yes | camera |
Response Attributes
Success:
Note: Response comes in json with 'data' as key
Parameter | Description | Example Value |
---|---|---|
data.camera | Value(1,0,-1) of parameter passed in permission | 1 |
RESPONSE CODES
Code | Description |
---|---|
-1 | not_determined, (applicable to iOS) |
0 | denied/unauthorised, |
1 | authorized |
Error Responses:
Parameter | Description | Example Value |
---|---|---|
error | Error | 2 |
message | Error message | Invalid parameter |
ERROR CODES
code | Description |
---|---|
2 | Invalid parameter |
REQUEST CODERESPONSE CODE
JAVASCRIPT
const requestObject={
permission: 'camera'
}
JSBridge.call('paytmCheckPermission',request
Object,
function(result) {
console.log(JSON.stringify(result))
});