Telephony / Cordova BarcodeScanner cordova.plugins undefined
Edit: What's with the voice? My question has been well researched and I don't believe I deserve it.
I know there are several questions regarding cordova.plugins
undefined, but I haven't been able to find a solution in all my research.
I am only targeting the Android platform.
I am trying to use the barcodescanner phonegap plugin and am constantly trying to use it. I always get the error:Cannot read property 'barcodeScanner' of undefined
Installation Information:
- Phone version:
3.5.0-0.20.4
- Do not use assembly of telephone conversations
- Cordova version:
3.5.0-0.2.6
- The installed plugin uses all of the following methods (independently, of course, for testing)
- Instructions are here https://github.com/wildabeast/BarcodeScanner/tree/master/src/android
-
cordova plugins add https://github.com/wildabeast/BarcodeScanner.git
-
phonegap plugin add https://github.com/wildabeast/BarcodeScanner.git
- Also tried to replace
http://github.com/phonegap-build/BarcodeScanner.git
with wildabeast version
From what I can tell, the plugin is installing correctly.
I used 3 different methods to check what I am doing: Browser (mainly Chrome), Ripple Chrome Extension, and Phonegap Developer App. I am getting an error in the browser and Ripple, but nothing happens in the Phonegap developer app.
The code is very simple.
The page to which it is called:
<div ng-controller="StorageMainCtrl">
<p ng-click="doScan()">Scan!</p>
</div>
Controller code handling the scan:
$scope.doScan = function() {
cordova.plugins.barcodeScanner.scan(
function (result) {
var s = "Result: " + result.text + "<br/>" +
"Format: " + result.format + "<br/>" +
"Cancelled: " + result.cancelled;
alert(s);
},
function (error) {
alert("Scanning failed: " + error);
}
);
};
source to share
No one has answered this question yet
Check out similar questions: