1

I want to override the public void onPermissionRequest(PermissionRequest) method for my WebChromeClient-object.

Here is my code:

mWebView.setWebChromeClient(new WebChromeClient() {
    @Override
    public void onPermissionRequest(final PermissionRequest request) {
        CallActivity.this.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                //TODO: do sth with the request
            }
        });
    }
});

I tried to import android.webkit.PermissionRequest, but it can't be resolved. Am I missing a library?

000000000000000000000
  • 1,467
  • 1
  • 19
  • 38

2 Answers2

1

It's only Added in API level 21 so you need to make sure to build your project with Android 21 or later.

Considering you're building for Google Glass, you're not able to use it at runtime. As far as I know Google Glass is running on Android 19 only.

tynn
  • 38,113
  • 8
  • 108
  • 143
  • Thank you! I wanted to use the webView with getUserMedia() (https://developer.mozilla.org/en-US/docs/Web/API/Navigator/getUserMedia) Can I do this without the permission/ WebChromeClient? – 000000000000000000000 Nov 10 '15 at 10:07
  • @RUB3N I don't know. I had a look for how it was done before, but couldn't find anything. I guess you might just need to give it a try. – tynn Nov 10 '15 at 10:13
1

As tynn pointed out, this is currently not possible, since Glass runs on API level 19, but API level 21 is required for getUserMedia.

However the guys over at Ericsson Research figured it out as you can see in this video.

They used OpenWebRTC.
Find out more about implementing it here.

Community
  • 1
  • 1
000000000000000000000
  • 1,467
  • 1
  • 19
  • 38