javaandroidpermissionswebkitwebchromeclient

android.webkit.PermissionRequest can't be resolved


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?


Solution

  • 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.