Barcode Scanner
The Barcode Scanner Plugin opens a camera view and automatically scans a barcode, returning the data back to you.
Requires Cordova plugin: phonegap-plugin-barcodescanner
. For more info, please see the BarcodeScanner plugin docs.
https://github.com/phonegap/phonegap-plugin-barcodescanner
Stuck on a Cordova issue?
If you're building a serious project, you can't afford to spend hours troubleshooting. Ionic’s experts offer premium advisory services for both community plugins and premier plugins.
Installation
- Capacitor
- Cordova
- Enterprise
$ npm install phonegap-plugin-barcodescanner
$ npm install @awesome-cordova-plugins/barcode-scanner
$ ionic cap sync
$ ionic cordova plugin add phonegap-plugin-barcodescanner
$ npm install @awesome-cordova-plugins/barcode-scanner
Ionic Enterprise comes with fully supported and maintained plugins from the Ionic Team. Learn More or if you're interested in an enterprise version of this plugin Contact Us
Supported Platforms
- Android
- BlackBerry 10
- Browser
- iOS
- Windows
Usage
React
Learn more about using Ionic Native components in React
Angular
import { BarcodeScanner } from '@awesome-cordova-plugins/barcode-scanner/ngx';
constructor(private barcodeScanner: BarcodeScanner) { }
...
this.barcodeScanner.scan().then(barcodeData => {
console.log('Barcode data', barcodeData);
}).catch(err => {
console.log('Error', err);
});