简体   繁体   English

Windows Phone 7上的条形码扫描器phonegap / cordova插件

[英]Barcode Scanner phonegap/cordova plugin on Windows Phone 7

I'm trying to implement the barcode scanner plugin on windows phone 7. I carried out the following steps according to the plugin's readme : 我正在尝试在Windows Phone 7上实现条形码扫描仪插件。我根据该插件的自述文件执行了以下步骤:
1. Added both the dll's to my project. 1.将这两个dll添加到我的项目中。
2. Added barcodescanner.js to the 'www' folder and included the js file in my 'index.html'. 2.将条形码扫描器.js添加到“ www”文件夹中,并将js文件包含在我的“ index.html”中。
3. Added BarcodeScanner.cs to my project. 3.将BarcodeScanner.cs添加到我的项目中。

I didn't find any guide to implement this on the windows phone platform, so i tried using this guide which was for Android to write the html/js for using the plugin. 我没有找到在Windows Phone平台上实现此功能的任何指南,因此我尝试使用指南, 指南是为Android编写使用插件的html / js。 I have inlcuded a button whose onclick calls the 'Scan()' function : 我已经包含一个按钮,其onclick调用了'Scan()'函数:

function Scan() {
window.plugins.barcodeScanner.scan(
    function(result) {
    alert("Scanned Code: " + result.text 
            + ". Format: " + result.format
            + ". Cancelled: " + result.cancelled);
}, function(error) {
    alert("Scan failed: " + error);
});
}

On running the app and clicking the button, I'm getting the following error in the console window : 在运行该应用程序并单击该按钮时,我在控制台窗口中收到以下错误:

Error:"Unable to get value of the property 'barcodeScanner': object is null or undefined file:x-wmapp1:/app/www/index.html Line:45"

How do i get this to work? 我该如何工作?

This was an issue related to Phonegap 2.7. 这是与Phonegap 2.7有关的问题。 It worked, somehow, when i tried it on 2.9.0. 当我在2.9.0上尝试时,它以某种方式起作用。

您是否在config.xml中添加了<plugin name="org.apache.cordova.barcodeScanner">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM