Barcode Scanner In Cordova

Posted By : Karan Bhardwaj | 23-Jan-2015

Basic Description:

 

Barcodes is basically used to provide asset & security tracking, theft deterrence. In general we can say that barcode reduces liability.Few years ago barcode scanning is done only through barcode reader devices and some thing like optical scanners but now we can scan barcode through our mobile devices, tablets, etc.Now i am representing that how create application to scan barcode.

 

In this I am using barcode Scanner plugin in Cordova to create barcode scanner application.

 

Supported Types Of Barcode

 

Support of Types Barcode Scanning Varies From Platform to Platform (Android,iOS,blackberry).

  • QR_CODE
  • DATA_MATRIX
  • UPC_E
  • UPC_A
  • EAN_8
  • EAN_13
  • CODE_128
  • CODE_39
  • CODE_93
  • CODABAR
  • ITF
  • RSS14
  • PDF417
  • RSS_EXPANDED

Installation :

 

Using Terminal go in your project directory, from inside your Cordova project you have to enter the following command.

 

 cordova plugin add https://github.com/wildabeast/BarcodeScanner.git
 

 

Working :

 

For Scanning bar through your Device Camera you have to use this "cordova.plugins.barcodeScanner.scan". In this .scan is the object created by Cordova Barcode Scanner plugin to scan bar code.

 

 function scanCode() {
	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);
	});
}
 

 

About Author

Author Image
Karan Bhardwaj

Karan is expert in JavaScript, JQuery, Phonegap, Java, Groovy and Grails, SpringBoot, Kurento, MongoDB, NodeJs, Wowza, FFmpeg and Kaltura.

Request for Proposal

Name is required

Comment is required

Sending message..