Scan QR and Barcode

Hi, I have a question. Is there a library (the most used or the best…) that scans barcodes and QR codes on both Android and iOS?

The versions I have of the Ionic project are:

  • NodeJS: 12.21.0
  • Ionic CLI: 6.20.8
  • Ionic Framework: @ionic/angular 5.6.12
  • @angular/cli: 12.1.3
  • Capacitor CLI: 3.9.0

Thanks!

I know the following two Capacitor plugins for scanning barcodes and QR codes:

  1. Capacitor Community Barcode Scanner
  2. Capacitor ML Kit Barcode Scanning

The biggest difference between the two plugins is the SDK used to recognise the barcodes. The Capacitor Community Barcode Scanner plugin uses the ZXing decoder and the Capacitor ML Kit Barcode Scanning plugin uses the ML Kit from Google.
However, both supported only the current Capacitor version (4+).

Disclaimer: I am the maintainer of the second plugin.

1 Like

Okay, thanks!

So, in my project with those versiones, will not work only because for Capacitor? Am I right?

Greetings.

Yes, you need to update your Capacitor version. However, you should also update your Capacitor version regardless of the plugin in order to comply with the current Play Store guidelines regarding the minimum SDK Targets (see Announcing Capacitor 4.0).

Hi Robin,

The ML Kit Barcode (maintained by you) works on Android 14, but it does not work on older devices (Android 11, 12, 13).

I followed the steps in Github. Am I missing something for older devices?

I cannot help you without any error message. Please create a GitHub issue with a minimal, reproducible example.

Just an update. Upon further Googling, I managed to find the solution.
This was the issue.

installGoogleBarcodeScannerModule

Solution provided here:

1 Like

Here’s another option that might help with your barcode scanning needs. Up front, this is a paid library, so if you’re looking for a free solution, the previously mentioned options are the way to go!

While the aforementioned solutions (ZXing and ML Kit-based) are free and great for most scanning use cases, let me also mention the Scanbot SDK for Capacitor as an alternative for more robust enterprise-level scanning needs.

Key differences of the Scanbot SDK for Capacitor:

  • Uses a proprietary barcode recognition model optimized for challenging scenarios such as damaged, dirty, small or very dense barcodes (like PDF417) where ZXing and ML Kit may have limitations.
  • Works offline on Android (5.1+) and iOS (13+)
  • Provides ready-to-use UI components with user guidance and customizable action bar – for simple (scanning a single barcode) and complex use cases (multi-barcode scanning, find & pick, scan & count, and more) with AR overlay options.

The SDK comes with an annual license fee based on the number of apps/domains (independent of the number of scans or users!). This includes dedicated chat support for integration and troubleshooting, which can be especially valuable for enterprise projects.

If you’re interested in trying it out or learning more:

Disclaimer: I work for Scanbot SDK

I’m using Ionic 8 and Capacitor 6.2 in my project. I have implemented the @capacitor-community/barcode-scanner plugin, but I’m facing an issue where it cannot scan EAN-13 barcodes.

Could anyone suggest a solution or workaround for this issue? Any help would be greatly appreciated!

That plugin has been archived so you probably don’t want to use it. Capacitor has a 1st party plugin now here - Barcode Scanner Capacitor Plugin API | Capacitor Documentation. I would try that.