Open surajgirhepunje opened 3 years ago
In the MainActyvity file inside asw_view.setWebChromeClient (new WebChromeClient () { add:
@Override
public void onPermissionRequest(final PermissionRequest request) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (!check_permission(3)) {
ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.CAMERA}, file_perm);
}
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(MainActivity.this)
.setTitle("Allow Permission to camera")
.setPositiveButton("Allow", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
request.grant(request.getResources());
Log.d(TAG, "Granted");
}
})
.setNegativeButton("Deny", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
request.deny();
Log.d(TAG, "Denied");
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
}
}
Thank you! This change allows camera usage again.
@ahtoh68 It is not working for me. I am using the latest SmartWebView Please anyone kindly help with the camera issue.
Same issue with me also. It was working perfectly before. Recently came to know that webview isn't supporting camera and audio permissions. Can anyone tell me the reason and possible solutions. Thanks in advance.
When I integrate the https://webcamtests.com/ in webview and checked the permission settings as well. Still got error. Please check screenshot.