Ionic 4 | Adding ZBar Barcode / QR Code Scanner in Ionic 4 Application using Cordova and Native Plugin

In a previous post we have already discussed the most used QR Code and Barcode Scanner Native plugin for IOnic Application, but today we will use another very popular native plugin based on ZBar library.

This is a very good plugin to scan a variety of Barcode types including EAN-13/UPC-A, UPC-E, EAN-8, Code 128, Code 39, Interleaved 2 of 5 and QR Code

Let’s discuss implementation

Create a new Ionic 4 Application


Add Cordova and Ionic Nativ plugin 

Next, we need to include the plugin in the app’s main module file. Replace the following code in app.module.ts file.

Now in the Home page, we will add a button to call scan method and add scan method in home component file file

Now you have added a Barcode scanner in Ionic 4 Application using ZBar native plugin. This will only work in the real device. Run  $ ionic cordova run android --device command to check in USB connected the real device.

Also See: Ionic 4 | Add Barcode/ QR Code Scanner/ Encoder Generator Ionic 4 Native Plugin


Thanks for visiting :) Let me know if you have some suggestions or feedback for this post in the comment section. Looking for any tutorial or demo on FreakyJolly, just drop me a message here

Leave a Reply

1 Comment threads
0 Thread replies
Most reacted comment
Hottest comment thread
1 Comment authors
Roger Recent comment authors
newest oldest most voted
Notify of

Thank you Freaky Jolly for this. Can get it to compile and run, but, does not scan consistently. Each time I scan the same code, I get a different result ?