Permissions
With HMSRoles
it's important to only request the appropriate permissions for user comfort. Some roles may require camera permissions, some may require the microphones and there are complex rules around whether bluetooth permission or bluetooth_connect permissions are required.
HMSSDK
can simplify this by returning a callback during join
and preview
that contains the appropriate permissions to request. Since permissions require an activity to request and watch approvals, this part of the handling requires action on your part to:
- Actually request the permissions
- Tell the SDK when they've been granted.
Implementation
Request the permissions callbacks be enabled.
val hmsSDK = HMSSDK .Builder(application)
.haltPreviewJoinForPermissionsRequest(true)..... // other builder params .build()
Implement the callback in ALL preview and join calls.
hmsSDK.preview(hmsConfig!!, object : HMSPreviewListener {
override fun onPermissionsRequested(permissions : List<String>) {// Send the permissions to your activity and request them.} }
Tell the SDK permissions have been granted.
When the permissions are granted call:
hmsSDK.setPermissionsAccepted()
Without this call the SDK will remain stuck waiting in preview or join. It doesn't matter if the user denies some permissions, in that case the associated devices will not work.
Whether the permissions have been accepted or denied, if you want the join/preview to continue, call this.
What permissions may be requested
Manifest.permission.RECORD_AUDIO
: For roles with an audio broadcasting permission.- Without it the user's microphone will remain disabled throughout the call.
Manifest.permission.CAMERA
: For roles with camera publish permissions.- Without it the user's camera will remain disabled throughout the call.