I am facing issue when using barcode scanner plugin for cordova.
I have tried all the below plug in’s and got same error.
cordova-plugin-barcodescanner (this used to work with phonegap app build but no longer working with volt builder build)
phonegap-plugins-barcodescanner
fttx-phonegap-plugin-barcodescanner
cordova-plugin-firebase-ml-kit-barcode-scanner
Below is the code m using
function getQrCode() {
try {
document.addEventListener("deviceready", onDeviceReady, false);
}
catch (err) {
alert(err);
showError("Failed while reading the QR code " + err);
}
};
function onDeviceReady() {
alert("Get QR Code 13");
cordova.plugins.barcodeScanner.scan(
function (result) {
//alert("We got a barcode\n" +
// "Result: " + result.text + "\n" +
// "Format: " + result.format + "\n" +
// "Cancelled: " + result.cancelled);
$(document).find("#filterTable-input1").val(result.text);
hitSaveButtonBrixReading = 0;
},
function (error) {
alert("Scanning failed: " + error);
}
);
}
Getting below error for all plug in’s i have tried so far
Cannot read properties of undefined (reading 'barcodescanner')) when code htis below line
cordova.plugins.barcodeScanner.scan
Can you please advise which plug in should i use for Bar code scanner that works fine with cordova.
Tip: If you’re pasting code, html or config files, surround the code with triple back ticks (```), before the first line and after the last one. It will be formatted properly. (We fixed it for you this time)
In the build log it shows downloading “cordova-plugin-whitelist” plugin but no entry for any other plug in.
Build logs
Discovered plugin "cordova-plugin-whitelist". Adding it to the project
No scripts found for hook "before_plugin_add".
Calling plugman.fetch on plugin "cordova-plugin-whitelist@^1.3.4"
Copying plugin "/node_modules/cordova-plugin-whitelist" => "/plugins/cordova-plugin-whitelist"
Calling plugman.install on plugin "/plugins/cordova-plugin-whitelist" for platform "android
Installing "cordova-plugin-whitelist" for android
Finding scripts for "before_plugin_install" hook from plugin cordova-plugin-whitelist on android platform only.
No scripts found for hook "before_plugin_install".
Install start for "cordova-plugin-whitelist" on android.
Beginning processing of action stack for android project...
Action stack processing complete.
Install complete for cordova-plugin-whitelist on android.
Finding scripts for "after_plugin_install" hook from plugin cordova-plugin-whitelist on android platform only.
No scripts found for hook "after_plugin_install".
Adding cordova-plugin-whitelist to package.json
I have tried few other ways but getting the same error.
I am not sure what i am doign worng here.
Can someone please adivse how to overcome this problem.
Just to let you know we are on paid plan for Volt builder app.
Tip: If you’re pasting code, html or config files, surround the code with triple back ticks (```), before the first line and after the last one. It will be formatted properly. (We fixed it for you this time)