I'm trying to add the Phonegap Barcode scanner plugin to my Phonegap app. I'm primarily developing for windows phone 8 but I also want to target the ios and android platforms. I managed to add the plugin correctly, but when I start the scan, my windows phone doesn't recognize any barcodes. It just shows the video screen with a focus button and a green square.
Here's my code for the scan:
function Scan() {
window.plugins.barcodeScanner.scan(function (result) {
barcode = result;
alert(barcode.text);
}, function (error) {
alert("Scanning failed: " + error);
});
};
this function is called on deviceready event.
Am I doing something wrong? Or did I miss something in the plugin? I read that android and ios need to set permission to execute this plugin. Do I need permission to enable it to scan in windows phone too?
UPDATE :
It seems I can scan QR code but not the regular one(SCC code). Someone have a clue on this?
Try using the ZXing Barcode Scanner for Windows Phone. It works quite well.
http://silverlightzxing.codeplex.com
You can call the class you create using PhoneGap. Then let the native plugin for ZXing do all the heavy work, and return back the code scanned to you in Javascript using the success function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With