简体   繁体   中英

Cordova BarcodeScanner continuous reading

I'm using MeteorJs and Cordova with the Barcodescanner plugin.
I need to do multiple reads of different qrcodes, and send every read to a remote server.

With this code I can make one read and then Cordova closes the camera (for make a new one I need to recall the code).

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

How can I make mutiple and continuous readings (without exiting from the camera reader)?

Thanks.

You could try something like:

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

In my meteor project ,I have been struggling with a problem of putting cordova barcode scanner inside a fixed div inside a template. Since , you also using same cordova barcode scanner plugin for meteor , i wanted to check whether yo could help any bit regarding this . Problem details is available at following link

MeteorJs putting Cordova barcode scanner inside a fixed div

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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