Grant special permissions to a WebView

Accessing the camera or location in a WebView is not possible without granting the WebView permission. Make sure your app has permissions already through the conventional method before calling this snippet:

WebSettings webSettings = webView.getSettings();
webView.setWebViewClient(new WebViewClient());
webView.setWebChromeClient(new WebChromeClient() {
    // Need to accept permissions to use the camera and audio
    public void onPermissionRequest(final PermissionRequest request) {
        Log.d(TAG, "onPermissionRequest");
        getActivity().runOnUiThread(new Runnable() {
            public void run() {
                // Make sure the request is coming from our file
                // Warning: This check may fail for local files
                // Remove this check if your webpage is from a different
                // source
                if (request.getOrigin().toString().equals(ASSET_FILE)) {
                } else {