instascan
instascan copied to clipboard
camera not recognize in native android webview
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.
Same is mine, doesn't work in android webview.
I tried everything I could but could not get the camera to show up when using the webview. Any suggestions?
Seems like all device-related will never work in a webview. I end up built a separate modules in JS.
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());
}
}
Does anyone get an update on this issue?