【发布时间】:2013-10-23 09:25:33
【问题描述】:
我是 Phonegap 和 JS 的新手...我尝试使用条形码扫描仪...我安装了 phonegap 以及本教程中的所有内容http://teusink.blogspot.com/2013/07/guide-phonegap-3-android-windows.html
我从 CMD 安装 BarcodeScanner 并将项目导出为 android 平台... 将其添加到 Eclipse ...按照所有教程操作,添加所有权限和内容..
当我在 ma samsung tab2 上尝试应用程序时......应用程序出现但当我单击“扫描”链接时,我收到错误未在 logcat 中找到的模块 cordova/plugin/BarcodeScanner。
这是<a href="#" class="btn large" onclick="scaning();">Scan</a的电话
我在 index html 头中有这个
<script src="phonegap.js"></script>
<script src="barcodescanner.js"></script>
这是扫描功能 函数扫描(){
var scanner = cordova.require("cordova/plugin/BarcodeScanner");
scanner.scan(
function (result) {
alert("We got a barcode\n" +
"Result: " + result.text + "\n" +
"Format: " + result.format + "\n" +
"Cancelled: " + result.cancelled);
},
function (error) {
alert("Scanning failed: " + error);
}
);};
这是在 config.xml 中
<feature name="BarcodeScanner">
<param name="android-package" value="com.phonegap.plugins.barcodescanner.BarcodeScanner" />
</feature>
我想我检查了整个谷歌的答案......但直到现在没有任何工作......而且对于 phonegap 3.0+ 版本,几乎没有条码扫描仪的文档......至少对于初学者来说。 ..
如果你们能帮帮我......因为我完全迷路了:S
【问题讨论】: