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 home.page.ts file

home.page.html

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

 

Leave a Reply

avatar
  Subscribe  
Notify of