0

In my application I have a class that handles audio recording and it has some javascript interfaces, so that I can invoke these functionalities in my WebView. This would work as it is with Android 5, however with Android 6 it does not, as the app does not have the permissions by default. I am not sure how to set the permissions up for js interfaces.

It seems that onPermissionRequest method is called by default for when I try to use getUserMedia API in the javascript code, but it isn't the case when I use the Javascript interfaces in my Java code.

I realize a hacky solution would be to call ActivityCompat.requestPermissions in the interface when it's invoked, since onRequestPermissionsResult will be called after the user makes a decision (Then I figure out if the request came from the JS interface or the JS code). I am just curious if there are any "cleaner" workarounds to this. Any help would be appreciated

1 Answer 1

1

Your approach is fine , additionally you can check/request for permission before loading content in webview . in case user has declined recording permission then you can disable recording feature from UI

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.