Phonegap条形码扫描器不能识别Windows Phone上的任何条形码 [英] The Phonegap Barcode Scanner don't recognize any barcode on windows phone

查看:202
本文介绍了Phonegap条形码扫描器不能识别Windows Phone上的任何条形码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Phonegap条码扫描程序插件添加到Phonegap应用程序。我主要是为windows phone 8开发,但我也想定位ios和android平台。我设法正确添加插件,但当我开始扫描,我的Windows手机无法识别任何条形码。它只是显示具有焦点按钮和绿色正方形的视频屏幕。

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.

这是扫描的代码:

    function Scan() {
      window.plugins.barcodeScanner.scan(function (result) {
        barcode = result;
        alert(barcode.text);
      }, function (error) {
        alert("Scanning failed: " + error);
      });
  };

此函数在deviceready事件中调用。

this function is called on deviceready event.

我做错了什么?还是我错过了插件中的东西?我看到Android和 ios 需要设置权限执行此插件。我需要权限才能在Windows手机中扫描?

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:

看来我可以扫描QR码,一个(SCC代码)。有人对此有一个线索?

It seems I can scan QR code but not the regular one(SCC code). Someone have a clue on this?

推荐答案

尝试使用Windows Phone的ZXing条形码扫描器。它工作得很好。

Try using the ZXing Barcode Scanner for Windows Phone. It works quite well.

http://silverlightzxing.codeplex.com

您可以使用PhoneGap调用您创建的类。然后让ZXing的本地插件做所有繁重的工作,并返回使用成功函数在Javascript中扫描到您的代码。

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.

这篇关于Phonegap条形码扫描器不能识别Windows Phone上的任何条形码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆