I'm trying to develop an extension that uses a WebView with a page that accesses the microphone.
I've tried setting the permissions for this in my Java code
@UsesPermissions(permissionNames = "android.permission.INTERNET, " +
"android.permission.WRITE_EXTERNAL_STORAGE, android.permission.READ_EXTERNAL_STORAGE, " +
"android.permission.RECORD_AUDIO, android.permission.MODIFY_AUDIO_SETTINGS, android.webkit.resource.AUDIO_CAPTURE")
I added WebSettings
webViewSettings.setJavaScriptEnabled(true);
webViewSettings.setMediaPlaybackRequiresUserGesture(false);
And I've tried granting the requests I see come in:
webView.setWebChromeClient(new WebChromeClient() {
@Override
public void onPermissionRequest(final PermissionRequest request) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
request.grant(request.getResources());
}
});
}
});
(I do see that get called with a request for android.webkit.resource.AUDIO_CAPTURE
)
But I'm still hitting permissions errors. When the javascript running in my WebView tries to access the microphone, I get permission denied errors, and I see this in my adb log:
cr_media: Requires MODIFY_AUDIO_SETTINGS and RECORD_AUDIO. No audio device will be available for recording
Can anyone help me work out what I've missed, please?