search

paytmRequestPermission JS API

Use Case

On Android, this parameter can be a comma-separated value. Example: "camera, record_audio, contacts". But on iOS, only one value can be specified. Below things can be passed in permission in the following cases:

  • iOS: camera, video, microphone, contacts, calendar, reminder, photos, location, and speech
  • Android: camera, record_audio, read_phone_numbers, contacts, calendar, body_sensors, storage, location, get_accounts, and read_phone_state

Request Attributes

Content format: JSON

ATTRIBUTES DESCRIPTION

permission

mandatory

Name of the parameter for whom permission is requested (Array of string)
Example: camera, record_audio

Response Attributes

Success

Note: Response comes in JSON with 'data' as key.

 

ATTRIBUTES DESCRIPTION
data.camera Value(1,0,-1) of parameter passed in the permission

Example: 1

data.record_audio

Value of parameter passed in permission

Example: 0

 

RESPONSE CODES

CODE DESCRIPTION
-1 not_determined, (applicable to iOS)
0 denied/unauthorised
1 authorized

ERROR CODES

PARAMETER DESCRIPTION
error Error
Example:2
message Error Message
Example: Invalid parameter

ERROR RESPONSES

CODE DESCRIPTION
2 Invalid parameter
⇾
REQUEST
RESPONSE
JAVASCRIPT
const requestObject = {
    permission: 'camera, record_audio'
	}
JSBridge.call('paytmRequestPermission', requestObject, 
   function(result) {
    console.log(JSON.stringify(result))
   });
copy icon