# Scan QR and Barcode

**URL:** <https://forum.ionicframework.com/t/scan-qr-and-barcode/233057>\
**Category:** ionic-v3\
**Created:** [April 27, 2023, 7:04am UTC](https://forum.ionicframework.com/t/scan-qr-and-barcode/233057 "2023-04-27T07:04:05Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![gassssty](https://avatars.discourse-cdn.com/v4/letter/g/5fc32e/32.png) [@gassssty](https://forum.ionicframework.com/u/gassssty)\
**Post date:** [April 27, 2023, 7:04am UTC](https://forum.ionicframework.com/t/scan-qr-and-barcode/233057/1 "2023-04-27T07:04:05Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![robingenz](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/robingenz/32/144137_2.png) [@robingenz](https://forum.ionicframework.com/u/robingenz)\
**Post date:** [April 27, 2023, 7:57am UTC](https://forum.ionicframework.com/t/scan-qr-and-barcode/233057/2 "2023-04-27T07:57:28Z")

</div>

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

1. [Capacitor Community Barcode Scanner](https://github.com/capacitor-community/barcode-scanner)
2. [Capacitor ML Kit Barcode Scanning](https://capawesome.io/plugins/mlkit/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](https://github.com/zxing/zxing/) decoder and the Capacitor ML Kit Barcode Scanning plugin uses the [ML Kit](https://developers.google.com/ml-kit) from Google.  
However, both supported only the current Capacitor version (4+).

**Disclaimer** : I am the maintainer of the second plugin.

---

<div class="post-metadata">

**Author:** ![gassssty](https://avatars.discourse-cdn.com/v4/letter/g/5fc32e/32.png) [@gassssty](https://forum.ionicframework.com/u/gassssty)\
**Post date:** [April 27, 2023, 8:19am UTC](https://forum.ionicframework.com/t/scan-qr-and-barcode/233057/3 "2023-04-27T08:19:43Z")

</div>

Okay, thanks!

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

Greetings.

---

<div class="post-metadata">

**Author:** ![robingenz](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/robingenz/32/144137_2.png) [@robingenz](https://forum.ionicframework.com/u/robingenz)\
**Post date:** [April 27, 2023, 8:32am UTC](https://forum.ionicframework.com/t/scan-qr-and-barcode/233057/4 "2023-04-27T08:32:41Z")

</div>

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](https://ionic.io/blog/announcing-capacitor-4-0)).

---

<div class="post-metadata">

**Author:** ![razmans](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/razmans/32/115790_2.png) [@razmans](https://forum.ionicframework.com/u/razmans)\
**Post date:** [March 28, 2024, 8:05pm UTC](https://forum.ionicframework.com/t/scan-qr-and-barcode/233057/5 "2024-03-28T20:05:08Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![robingenz](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/robingenz/32/144137_2.png) [@robingenz](https://forum.ionicframework.com/u/robingenz)\
**Post date:** [March 28, 2024, 8:53pm UTC](https://forum.ionicframework.com/t/scan-qr-and-barcode/233057/6 "2024-03-28T20:53:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![razmans](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/razmans/32/115790_2.png) [@razmans](https://forum.ionicframework.com/u/razmans)\
**Post date:** [March 29, 2024, 12:34pm UTC](https://forum.ionicframework.com/t/scan-qr-and-barcode/233057/7 "2024-03-29T12:34:17Z")

</div>

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

```auto
installGoogleBarcodeScannerModule

```

Solution provided here:

> <https://github.com/capawesome-team/capacitor-mlkit/issues/38>
>
> \### Plugin(s)
> 
> \- \[X\] Barcode Scanning
> \- \[\] Translation
> 
> \### Did you test the la…test version?
> 
> \- \[X\] I use the latest version
> 
> \### Platform(s)
> 
> \- \[X\] Android
> \- \[\] iOS
> \- \[\] Web
> 
> \### Current behavior
> 
> When calling the \`scan(...)\` the following error message appears in Android Studio:
> 
> \`\`\`
> scan failed.
> com.google.mlkit.common.MlKitException: Failed to scan code.
> at com.google.mlkit.vision.codescanner.internal.zze.zzc(com.google.android.gms:play-services-code-scanner@@16.0.0-beta3:4)
> at com.google.mlkit.vision.codescanner.internal.zzf.onActivityResult(com.google.android.gms:play-services-code-scanner@@16.0.0-beta3:5)
> at androidx.activity.result.ActivityResultRegistry.doDispatch(ActivityResultRegistry.java:409)
> at androidx.activity.result.ActivityResultRegistry.dispatchResult(ActivityResultRegistry.java:366)
> at androidx.activity.ComponentActivity.onActivityResult(ComponentActivity.java:712)
> at android.app.Activity.dispatchActivityResult(Activity.java:8951)
> at android.app.ActivityThread.deliverResults(ActivityThread.java:5987)
> at android.app.ActivityThread.handleSendResult(ActivityThread.java:6033)
> at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:67)
> at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
> at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
> at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
> at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2574)
> at android.os.Handler.dispatchMessage(Handler.java:106)
> at android.os.Looper.loopOnce(Looper.java:226)
> at android.os.Looper.loop(Looper.java:313)
> at android.app.ActivityThread.main(ActivityThread.java:8757)
> at java.lang.reflect.Method.invoke(Native Method)
> at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
> at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
> \`\`\`
> 
> \### Expected behavior
> 
> No exception.
> 
> \### Reproduction
> 
> \-
> 
> \### Steps to reproduce
> 
> 1. Call the \`scan(...)\` method on Android
> 
> Seems to be reproducible only on some devices (e.g. Samsung S21 with Android 13).
> 
> \### Other information
> 
> \_No response\_
> 
> \### Capacitor doctor
> 
> \-
> 
> \### Before submitting
> 
> \- \[X\] I understand that incomplete issues (e.g. without reproduction) are closed.

---

<div class="post-metadata">

**Author:** ![sb-jeremias](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@sb-jeremias](https://forum.ionicframework.com/u/sb-jeremias)\
**Post date:** [January 2, 2025, 9:03am UTC](https://forum.ionicframework.com/t/scan-qr-and-barcode/233057/8 "2025-01-02T09:03:08Z")

</div>

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:

- **Documentation** : [Introduction | Capacitor Barcode Scanner | Scanbot SDK Documentation](https://docs.scanbot.io/barcode-scanner-sdk/capacitor/introduction/)
- **Getting Started Guide** : [Ionic Capacitor Barcode Scanner tutorial - Scanbot SDK](https://scanbot.io/techblog/ionic-capacitor-barcode-scanner-tutorial/)
- **Free 7-day trial license** : [Developer Trial - Explore our Scanner Software - Scanbot SDK](https://scanbot.io/trial/)

**Disclaimer** : I work for Scanbot SDK

---

<div class="post-metadata">

**Author:** ![mahdy23](https://avatars.discourse-cdn.com/v4/letter/m/7cd45c/32.png) [@mahdy23](https://forum.ionicframework.com/u/mahdy23)\
**Post date:** [January 22, 2025, 1:55pm UTC](https://forum.ionicframework.com/t/scan-qr-and-barcode/233057/9 "2025-01-22T13:55:11Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![twestrick](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/twestrick/32/136131_2.png) [@twestrick](https://forum.ionicframework.com/u/twestrick)\
**Post date:** [January 22, 2025, 1:57pm UTC](https://forum.ionicframework.com/t/scan-qr-and-barcode/233057/10 "2025-01-22T13:57:18Z")

</div>

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](https://capacitorjs.com/docs/apis/barcode-scanner). I would try that.
