I am using zxing-scanner in Angular Web App and that Web App will load in Cordova App's Web View.
Scanner working fine in Chrome(Desktop/Tablet/Mobile) but its not working in Cordova App's Web View.
Note:
Camera permission already granted to the Cordova App.
zxing-scanner askForPermission TypeError:
navigator.mediaDevices.getUserMedia is not a function(...)
@zxing/ngx-scanner I was not able to define if I have permission for camera or not. TypeError: navigator.mediaDevices.getUserMedia is not a function(...)

You don't have your permissions properly set. Do the following:
xmlns:android="http://schemas.android.com/apk/res/android" to the <widget> tag in your config.xml<platform name="android"> tag in your config.xml:<config-file parent="/manifest" target="AndroidManifest.xml">
<uses-permission android:name="android.permission.CAMERA" />
</config-file>
const permissions = window.cordova.plugins.permissions;
permissions.checkPermission('android.permission.CAMERA', (status) => {
if (!status.hasPermission) {
permissions.requestPermission('android.permission.CAMERA', (request) => {
console.log('Success requesting CAMERA permission:', request);
}, (error) => {
console.log('Failed to set permission:', error);
});
}
});
Thanks @benbrownlol.
Anybody got this working on iOS?
I'm not sure with Cordova, but inside a PWA it's impossible until now.
Hi Obahcam, thx for your reply.
PWA isn't support by iOS enough indeed, although it does work fine in a browser. But it is why I'm trying with Cordova.
I'll open a seperate issue for it.
Most helpful comment
You don't have your permissions properly set. Do the following:
xmlns:android="http://schemas.android.com/apk/res/android"to the<widget>tag in your config.xml<platform name="android">tag in your config.xml: