Video call not working, app crash when try to ask permission.

I am trying to make a video call that requires a camera to work but the moment I press “Allow camera” on the permission message popup, the app just crashed. 

Solution:

First of all, allow permission, Update the permission from AndroidManifest.xml

The mobile browser and android app permission are little bit different. Android doesn’t allow ask permission multiple times. To avoid the crash update bellow code.

Then update this line of code. (If your project already updated then no need to change)

override fun onPermissionRequest(permissionRequest: PermissionRequest?) {
Log.d(TAG, "onJSPermissionRequest")

for (request in permissionRequest?.resources!!){
when(request){
Manifest.permission.CAMERA -> checkPermission(PERMISSIONS_REQUEST_CAMERA, true)
Manifest.permission.RECORD_AUDIO -> checkPermission(PERMISSIONS_REQUEST_MICROPHONE, true)
"android.webkit.resource.VIDEO_CAPTURE" -> checkPermission(PERMISSIONS_REQUEST_CAMERA, true)
"android.webkit.resource.AUDIO_CAPTURE" -> checkPermission(PERMISSIONS_REQUEST_MICROPHONE, true)
}
}
}

After doing this if the video is not open then maybe you force permission before the call. Because your Android app already has permission to open the camera directly. No need to ask permission multiple times.

2 thoughts on “Video call not working, app crash when try to ask permission.

Leave a Reply