Cordova BarcodeScanner 连续阅读
Cordova BarcodeScanner continuous reading
我将 MeteorJs 和 Cordova 与 Barcodescanner 插件一起使用。
我需要多次读取不同的二维码,并将每次读取发送到远程服务器。
有了这个代码,我可以读取一个,然后 Cordova 关闭相机(要制作一个新的,我需要回忆代码)。
cordova.plugins.barcodeScanner.scan(
function(result) {
Meteor.call('newQR', result.text);
},
function(error) {
alert("Scanning failed: " + error);
}
);
如何进行多次连续读数(不退出相机reader)?
谢谢。
您可以尝试类似的方法:
function scanBarcode() {
cordova.plugins.barcodeScanner.scan(
function(result) {
Meteor.call('newQR', result.text);
if( !result.cancelled ) {
scanBarcode();
}
},
function(error) {
alert("Scanning failed: " + error);
}
);
}
scanBarcode();
在我的流星项目中,我一直在努力解决将 cordova 条形码扫描器放入模板内固定 div 的问题。因为,你也为流星使用相同的科尔多瓦条形码扫描仪插件,我想看看你是否能对此有所帮助。问题详情可在以下 link
MeteorJs putting Cordova barcode scanner inside a fixed div
我将 MeteorJs 和 Cordova 与 Barcodescanner 插件一起使用。
我需要多次读取不同的二维码,并将每次读取发送到远程服务器。
有了这个代码,我可以读取一个,然后 Cordova 关闭相机(要制作一个新的,我需要回忆代码)。
cordova.plugins.barcodeScanner.scan(
function(result) {
Meteor.call('newQR', result.text);
},
function(error) {
alert("Scanning failed: " + error);
}
);
如何进行多次连续读数(不退出相机reader)?
谢谢。
您可以尝试类似的方法:
function scanBarcode() {
cordova.plugins.barcodeScanner.scan(
function(result) {
Meteor.call('newQR', result.text);
if( !result.cancelled ) {
scanBarcode();
}
},
function(error) {
alert("Scanning failed: " + error);
}
);
}
scanBarcode();
在我的流星项目中,我一直在努力解决将 cordova 条形码扫描器放入模板内固定 div 的问题。因为,你也为流星使用相同的科尔多瓦条形码扫描仪插件,我想看看你是否能对此有所帮助。问题详情可在以下 link
MeteorJs putting Cordova barcode scanner inside a fixed div