【问题标题】:Cordova BarcodeScanner continuous readingCordova BarcodeScanner 连续读取
【发布时间】:2015-08-21 23:57:27
【问题描述】:

我将 MeteorJs 和 Cordova 与 Barcodescanner 插件一起使用。
我需要对不同的二维码进行多次读取,并将每次读取发送到远程服务器。

使用此代码,我可以读取一次,然后 Cordova 关闭相机(要制作一个新的,我需要调用代码)。

cordova.plugins.barcodeScanner.scan(
    function(result) {
        Meteor.call('newQR', result.text);
    },
    function(error) {
        alert("Scanning failed: " + error);
    }
);

如何进行多次连续读数(不退出相机阅读器)?

谢谢。

【问题讨论】:

标签: javascript android cordova meteor qr-code


【解决方案1】:

在我的流星项目中,我一直在努力解决将科尔多瓦条形码扫描仪放在模板内的固定 div 中的问题。因为,您也使用相同的 cordova 条码扫描器插件用于流星,所以我想检查一下您是否可以对此有所帮助。问题详情见以下链接

MeteorJs putting Cordova barcode scanner inside a fixed div

【讨论】:

    【解决方案2】:

    你可以试试这样的:

    function scanBarcode() {
        cordova.plugins.barcodeScanner.scan(
            function(result) {
                Meteor.call('newQR', result.text);
                if( !result.cancelled ) {
                    scanBarcode();
                }
            },
            function(error) {
                alert("Scanning failed: " + error);
            }
        );
    }
    scanBarcode();
    

    【讨论】:

    • 工作得很好,谢谢!我也看到过这种方式也有效。 if (result.text.length === 0) return;
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-07-23
    • 2012-06-28
    • 1970-01-01
    • 2018-10-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多