-
Notifications
You must be signed in to change notification settings - Fork 37
How to implement onPermissionRequest() ? #78
Comments
Varient 1 will probably break some of the minor features in the plugin. fullscreen, alerts, console etc. I don't Variant 2 can work, unless the function is already defined in the JavaScript layer. The android runtime creates a Java wrapper at compile time. I haven't tried to setup permissions like that in the webview, but I'll see what I can do. |
I think, I've solved it on Android, but I need you to test it and if the test is successful, I need a teammate to review the code. This might take a while since, we're working on a new project. Install You also need to install webview.on(WebViewExt.requestPermissionsEvent, (args: RequestPermissionsEventData) => {
const wantedPerssions = args.permissions
.map((p) => {
if (p === "RECORD_AUDIO") {
return android.Manifest.permission.RECORD_AUDIO;
}
if (p === "CAMERA") {
return android.Manifest.permission.CAMERA;
}
return p;
})
.filter((p) => !!p);
permissions
.requestPermissions(wantedPerssions)
.then(() => args.callback(true))
.catch(() => args.callback(false));
}); |
According to https://bugs.webkit.org/show_bug.cgi?id=188360 we cannot add support on |
@m-abs could you add it in 8.0.0 ? i have the need for it on android |
Hi, thanks for your NS plugin, it's awesome! 👏
I'm trying to implement:
WebChromeClient#onPermissionRequest(android.webkit.PermissionRequest)
(link to android docs)to simply grant access to microphone and camera into WebView, but with no success 😢
Here's my code snippet (
WebViewExt
'sloadStarted
event handler):As you can see, I tried with two different variants, but no one works.
Important notice - I've already added required permissions to my
AndroidManifest.xml
and check & request these permissions during app runtime (before WebView loaded):JS script loaded on page in WebView, still cannot enumerate devices by calling
navigator.mediaDevices.getUserMedia()
, but prototyped native Android app can get access to these devices.Where am I wrong?
Hope for your quick reply and thanks in advance 😃
The text was updated successfully, but these errors were encountered: