how to scan barcode using phonegap

AndroidIphoneCordovaBarcode Scanner

Android Problem Overview


I need to scan a barcode using phonegap in Android and iPhone. Is there a way to do this?

Android Solutions


Solution 1 - Android

Kris Erickson is correct, the Zxing & Phonegap projects has already taken care of the heavy lifting for you. (My current SO reputation disallows me from commenting, but I would have.)

I've just made an Phonegap/Android app that scans a QR barcode using the plugin here. Follow the instructions and you should be successful. It's possible that the plugin has been written since Kris's answer.

The Javascript is simple, taken straight from https://github.com/phonegap/phonegap-plugins/

  	var scanBarcode = function() {
	window.plugins.barcodeScanner.scan( BarcodeScanner.Type.QR_CODE,function(result) {
        alert("We got a barcode: " + result);
    }, function(error) {
        alert("Scanning failed: " + error);
    }, {yesString: "Install"}
    );
 }  	

Solution 2 - Android

Your going to have a build a Phonegap plug-in, but the hard work has already be done for you by zxing.

Solution 3 - Android

This link leads you to a page where you can learn how to implement the PhoneGap Barcode Scanner plugin in your application

Solution 4 - Android

I recently used the ZBar plugin + the PhoneGap plugin to access ZBar. More details here - http://blog.infoentropy.com/Use_ZBar_barcode_reader_with_PhoneGap.

Solution 5 - Android

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionNewbeeView Question on Stackoverflow
Solution 1 - AndroidRobLabsView Answer on Stackoverflow
Solution 2 - AndroidKris EricksonView Answer on Stackoverflow
Solution 3 - AndroidOrangeTuxView Answer on Stackoverflow
Solution 4 - AndroidKaySubbView Answer on Stackoverflow
Solution 5 - AndroidPrabhunath YadavView Answer on Stackoverflow