Lit*_*tBe 3 plugins module cordova
我是Phonegap和JS的新手......我用条形码扫描仪试了一下......我用本教程安装了phonegap和所有内容 http://teusink.blogspot.com/2013/07/guide-phonegap-3 -Android-windows.html
我从CMD安装了BarcodeScanner并将项目导出为android平台...将其添加到Eclipse中......按照所有教程的说明如何操作,添加了所有权限和内容..
当我尝试在ma samsung tab2上的应用程序...应用程序出现但当我点击"扫描"链接时,我得到错误未捕获模块cordova /插件/在logcat中找不到BarcodeScanner.
这是电话 <a href="#" class="btn large" onclick="scaning();">Scan</a
我在索引html头中有这个
<script src="phonegap.js"></script>
<script src="barcodescanner.js"></script>
Run Code Online (Sandbox Code Playgroud)
这是scaning功能scaning(){
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);
}
);};
Run Code Online (Sandbox Code Playgroud)
这是在config.xml中
<feature name="BarcodeScanner">
<param name="android-package" value="com.phonegap.plugins.barcodescanner.BarcodeScanner" />
</feature>
Run Code Online (Sandbox Code Playgroud)
我想我检查了整个谷歌的答案......但到目前为止没有任何效果......而且仍然为phonegap 3.0+版本提供条码扫描器几乎没有文件......至少对于初学者来说......
如果你能帮助我们......那我完全迷失了:S
虽然我从未使用旧版本,因为我是Phonegap/Cordova的新手,但版本3.1似乎使用了稍微不同的方法来访问插件.以下为Cordova 3.1和BarcodeScanner工作.
安装插件
plugman install --platform android --project=DIR-TO-CORDOVA-PROJECT --plugin=https://github.com/wildabeast/BarcodeScanner
Run Code Online (Sandbox Code Playgroud)
您不必自己引用barcodescanner.js,cordova负责包含 - 来自https://github.com/wildabeast/BarcodeDemo的示例代码工作,除了我必须更改插件路径
var scanner = cordova.require("cordova/plugin/BarcodeScanner");
Run Code Online (Sandbox Code Playgroud)
至
var scanner = cordova.require("com.phonegap.plugins.barcodescanner.BarcodeScanner");
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9464 次 |
| 最近记录: |