Phonegap 条码扫描器无法识别 Windows 手机上的任何条码 [英] The Phonegap Barcode Scanner don't recognize any barcode on windows phone

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

问题描述

我正在尝试将 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 和 需要设置权限执行这个插件.我是否也需要获得许可才能在 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?

更新:

我似乎可以扫描二维码,但不能扫描常规的(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的原生插件完成所有繁重的工作,并使用success函数将扫描的代码在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 手机上的任何条码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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