instascan icon indicating copy to clipboard operation
instascan copied to clipboard

camera not recognize in native android webview

Open andylim1211 opened this issue 5 years ago • 5 comments

i've been able to scan QR codes through browsers (firefox,chrome) but not in webview. the camera list always returns null. given permission to .CAMERA and uses-feature in manifest too. can anybody please help. Thanks.

andylim1211 avatar Oct 18 '18 09:10 andylim1211

Same is mine, doesn't work in android webview.

erhimanshusaxena avatar Jan 22 '19 12:01 erhimanshusaxena

I tried everything I could but could not get the camera to show up when using the webview. Any suggestions?

Khrysller avatar Jul 20 '19 22:07 Khrysller

Seems like all device-related will never work in a webview. I end up built a separate modules in JS.

andylim1211 avatar Jul 22 '19 03:07 andylim1211

String permission = Manifest.permission.CAMERA; int grant = ContextCompat.checkSelfPermission(this, permission);

if (grant != PackageManager.PERMISSION_GRANTED) {
    String[] permission_list = new String[1];
    permission_list[0] = permission;
    ActivityCompat.requestPermissions(this, permission_list, 1);
} 

webView.setWebChromeClient(new WebChromeClient() {

            @TargetApi(Build.VERSION_CODES.LOLLIPOP)
            @Override
            public void onPermissionRequest(final PermissionRequest request) {
                request.grant(request.getResources());
            }
}

LedgerX-Code avatar May 27 '20 07:05 LedgerX-Code

Does anyone get an update on this issue?

isasenoaji avatar Oct 24 '23 16:10 isasenoaji