I am trying to use the Phonegap Barcode Scanner plugin on my app. When I view in Phonegap Desktop, the scanner doesn't display but I get an alert asking me to input the barcode number. However, when I package the app, submit to Phonegap Build and test on my phone, the barcode scanner/camera doesn't open and the alert doesn't appear.
I've installed android and browser as platforms to my project.
cordova.plugins.barcodeScanner.scan(
function (result) {
alert("We got a barcode\n" +
"Result: " + result.text + "\n" +
"Format: " + result.format + "\n" +
"Cancelled: " + result.cancelled);
},
function (error) {
alert("Scanning failed: " + error);
}
);
Add permission in AndroidManifest.xml
file.
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-permission android:name="android.permission.INTERNET" />
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.