I have been writing my app in Brackets and have been building it with PhoneGap build so i can have Android and iPhone versions from programming on windows.
I am trying to use a barcode scanner that will work in both Android and iPhone:
https://www.npmjs.com/package/phonegap-plugin-barcodescanner-quick
But the directions say to type commands in the CLI, which I have not been using since I have been suing PhoneGap build.
I tried adding the code into my like so:
$(document).ready(function () { //todo get user id from local storage var searchTerm = window.localStorage.getItem("search"); var userID = window.localStorage.getItem("userID"); var history = []; var lastUpdate = window.localStorage.getItem("searchUpdateTime"); //todo scan stuff 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); } ); ... But when I use the PhoneGap desktop app on windows and their Android app the scanner never opens.
Update:
Tried adding this code to my project for testing purposes, based on one of the answers below, but it returned nothing: //todo scan stuff if (cordova.plugins.barcodeScanner) {alert("Have a scanner object at least...");} else{alert("nope");