The Phonegap Barcode Scanner don't recognize any barcode on windows phone

可紊 提交于 2019-12-12 07:25:46

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/15435421/the-phonegap-barcode-scanner-dont-recognize-any-barcode-on-windows-phone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!