【发布时间】:2024-05-20 02:55:01
【问题描述】:
我需要在 Android 和 iPhone 中使用 phonegap 扫描条形码。 有没有办法做到这一点?
【问题讨论】:
-
你找到解决方案了吗?
标签: android iphone cordova barcode-scanner
我需要在 Android 和 iPhone 中使用 phonegap 扫描条形码。 有没有办法做到这一点?
【问题讨论】:
标签: android iphone cordova barcode-scanner
Kris Erickson 是对的,Zxing 和 Phonegap 项目已经为您完成了繁重的工作。 (我目前的 SO 声誉不允许我发表评论,但我愿意。)
我刚刚制作了一个 Phonegap/Android 应用程序,它使用插件 here 扫描二维码。按照说明进行操作,您应该会成功。自从 Kris 的回答以来,可能已经编写了该插件。
Javascript 很简单,直接取自https://github.com/phonegap/phonegap-plugins/
var scanBarcode = function() {
window.plugins.barcodeScanner.scan( BarcodeScanner.Type.QR_CODE,function(result) {
alert("We got a barcode: " + result);
}, function(error) {
alert("Scanning failed: " + error);
}, {yesString: "Install"}
);
}
【讨论】:
This link 将您带到一个页面,您可以在其中学习如何在您的应用程序中实现 PhoneGap 条码扫描器插件
【讨论】:
我最近使用 ZBar 插件 + PhoneGap 插件来访问 ZBar。更多细节在这里 - http://blog.infoentropy.com/Use_ZBar_barcode_reader_with_PhoneGap。
【讨论】:
【讨论】: