【问题标题】:How to retrive and use data from "window.plugins.barcodeScanner.scan" PhoneGap Zxing plugin?如何从“window.plugins.barcodeScanner.scan”PhoneGap Zxing 插件中检索和使用数据?
【发布时间】:2012-11-07 22:57:42
【问题描述】:

我正在使用 PhoneGap 开发一个 Android 应用程序。我正在使用 ZXing 插件来扫描二维码。

在 index.html 中,我放了一个按钮来扫描二维码:

<a href="#" onclick="scanCode();">

下面是java-script文件中scanCode的代码:

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

}

我想从“result”中检索数据,尤其是“result.text”,以便在另一个 html 文件中使用它们。

请问我该怎么做?

谢谢。

【问题讨论】:

    标签: android qr-code zxing phonegap-plugins barcode-scanner


    【解决方案1】:

    result.text 已经是扫描的文本了。

    试试这个:

    var thetext = result.text;
    

    【讨论】:

      【解决方案2】:

      https://github.com/phonegap/phonegap-plugins/tree/master/Android/BarcodeScanner 谈论添加 src.com.phonegap.plugins.barcodescanner.BarcodeScanner.java。

      【讨论】:

        猜你喜欢
        • 2023-03-03
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-08-20
        • 2016-03-14
        相关资源
        最近更新 更多