我需要一些幫助,將條形碼讀取器插件插入我的phonegap應用程序中。Phonegap BarcodeReader不工作
我已經通過cli將插件添加到我的phonegap項目中。現在有一個barcodescanner.js裏面的插件文件夾。我在我的config.xml中添加了''<'gap:plugin name =「com.phonegap.plugins.barcodescanner」/>「。這是我的index.html代碼:
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<script src="plugins/com.phonegap.plugins.barcodescanner/www/barcodescanner.js"></script>
<link rel="stylesheet" type="text/css" href="css/index.css" />
<title>Hello World</title>
<script>
function scanner() {
cordova.plugins.barcodeScanner.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);
}
);
}
</script>
</head>
<body>
<input type="button" value="Scan" onClick="scanner()" />
</body>
</html>
如果我在我的按鈕,單擊該logcat中說,它無法找到cordova.plugins ......有沒有人遇到過這個問題?
哇..我只是爲了進口只用了幾個小時...非常感謝! :) – TobiasW
是的,我發現自動導入插件也很難(在我的例子中,代碼被執行兩次 - 一次從'