Cordova & Ionic

Cordova Barcode Scanner SDK

Add barcode, MRZ and VIN scanning to Cordova and Ionic apps on Android and iOS. Install the barkoder-cordova plugin with one command, replace the deprecated PhoneGap barcode scanner, and test it on your own barcodes with a free 30-day trial.

cordova barcode scanner

One Cordova barcode scanner plugin for Ionic, Angular, React, Vue and plain JavaScript

barkoder-cordova is a Cordova barcode scanner plugin published on npm. It places the native barKoder scanner over an element in your page and sends each result back to a JavaScript callback. The docs include Angular, React, Vue and vanilla JavaScript examples.

Install the Cordova barcode scanner

Add the plugin to your Cordova project:

Shell
          cordova plugin add barkoder-cordova
        

The plugin builds for Android and iOS. Without a license it still scans, but results come back marked (Unlicensed) and only partly readable, so request a trial key before you measure anything.

Start your free trial

Building with Ionic?

Ionic on Cordova: add the same plugin. Ionic Angular projects can also call it through the Ionic Native wrapper @awesome-cordova-plugins/barkoder, which exports a Barkoder class from @awesome-cordova-plugins/barkoder/ngx:

Shell
            ionic cordova plugin add barkoder-cordova
            npm install @awesome-cordova-plugins/barkoder
          

Ionic on Capacitor: use the barkoder-capacitor plugin instead. It is built for Capacitor 6 and later.

Go to the Capacitor Barcode Scanner Plugin

Scan your first barcode in a Cordova app

This Angular example is copied from the barkoder-cordova README and the Cordova general example in the barKoder docs. React, Vue and vanilla JavaScript apps call the same Barkoder methods.

  1. Register Once the platform is ready, call registerWithLicenseKey with your trial or production key.
  2. Place Pass the size and position of your barkoderView element to initialize.
  3. Configure Enable the barcode types you need and set the region of interest.
  4. Scan Call startScanning and read decoderResults from each BarkoderResult in the callback.
your-page.ts
            declare var Barkoder: any;
            import { BarkoderResult, BarcodeType } from 'plugins/barkoder-cordova-plugin/www/BarkoderConfig';
            @ViewChild('barkoderView') barkoderViewRef!: ElementRef;
            constructor(private platform: Platform) {}
            ngAfterViewInit() {
            this.platform.ready().then(() => {
            Barkoder.registerWithLicenseKey("YOUR_LICENSE_KEY");
            setTimeout(() => {
            const boundingRect = this.barkoderViewRef.nativeElement.getBoundingClientRect() as DOMRect;
            Barkoder.initialize(
            Math.round(boundingRect.width),
            Math.round(boundingRect.height),
            Math.round(boundingRect.x),
            Math.round(boundingRect.y)
            );
            this.setBarkoderSettings();
            this.setActiveBarcodeTypes();
            }, 200);
            });
            }
            setActiveBarcodeTypes() {
            Barkoder.setBarcodeTypeEnabled(BarcodeType.qr, true);
            Barkoder.setBarcodeTypeEnabled(BarcodeType.code128, true);
            Barkoder.setBarcodeTypeEnabled(BarcodeType.ean13, true);
            }
            setBarkoderSettings() {
            Barkoder.setRegionOfInterestVisible(true);
            Barkoder.setRegionOfInterest(5, 5, 90, 90);
            Barkoder.setImageResultEnabled(true);
            Barkoder.setBarcodeThumbnailOnResultEnabled(true);
            }
            startScanning() {
            Barkoder.startScanning((data: any) => {
            console.log("startScanning results called");
            const barkoderResult = new BarkoderResult(data);
            if (barkoderResult) {
            barkoderResult.decoderResults.forEach((result, index) => {
            console.log(`Result ${index + 1}: ${result.textualData}`);
            });
            }
            }, (err: any) => {
            console.log(err);
            });
            }
          
your-page.html
            <div id="barkoderView" #barkoderView >
          
your-page.scss
            #barkoderView {
            height: 400px;
            }
          

Not using Angular? Follow the vanilla JavaScript integration example, the React integration example or the Vue integration example. Every method is listed in the Cordova SDK API reference.

A phonegap barcode scanner alternative for existing apps

phonegap-plugin-barcodescanner is marked deprecated on npm, and its GitHub repository was archived in August 2020. cordova-plugin-barcodescanner has had no release since February 2018. Many Cordova and Ionic apps still depend on one of them. Here is what changes when you move to barkoder-cordova.

What works differently

  • The old plugin opens its own camera screen with scan() and returns one result. barKoder draws the camera into an area of your page that you size with initialize, so your own UI stays visible.
  • Result fields change: text and format become textualData and barcodeTypeName.
  • You enable only the barcode types you need, and you can keep the session open for continuous scanning.
  • barKoder needs a license key. Without one, results are marked (Unlicensed) and only partly readable.
  • barkoder-cordova targets Android and iOS. The old plugin also listed Windows and Browser. For browser scanning, use the Web Barcode Scanner SDK (WASM).

Move in five steps

  1. Remove the old plugin with cordova plugin rm and its plugin ID.
  2. Run cordova plugin add barkoder-cordova, or the Ionic commands above.
  3. Add a barkoderView element where the camera preview should appear.
  4. Replace each scan() call with registerWithLicenseKey, initialize and startScanning, and map the new result fields.
  5. Scan the same sample barcodes on the same devices you tested with the old plugin before you release.
Get a trial key for the migration

A free plugin can still be enough for occasional QR codes in good light. If you pick a free plugin based on ML Kit, check whether its repository is still maintained, because several Cordova forks are archived.

Already running barkoder-cordova 1.6.8?

Many production Cordova apps pin an exact plugin version. Here is what the newer releases change, based on the published npm packages.

What 1.7 adds

1.7.1 (August 2026) and 1.7.2 (September 2026)

Version 1.7.2 keeps every JavaScript method from 1.6.8 and adds 14 new ones. Among them: setMatchFilter, which sets a string or regular expression that decoded data should match, matched-results options for normal and AR scanning, setPreviewMirrored, setRoiCenterMark and getDeviceId. The plugin.xml structure is unchanged.

Check the methods in the Cordova SDK API reference →

Check your iOS deployment target

iOS 12.0 up to 1.7.1, iOS 15.0 in 1.7.2

The iOS framework in 1.6.8 and 1.7.1 declares iOS 12.0 as its minimum. The framework in 1.7.2 declares iOS 15.0. If your app still supports older iPhones, upgrade to 1.7.1 first, or raise your deployment target. To install an exact version, add it to the plugin spec:

Shell
                cordova plugin add barkoder-cordova@1.7.2
              
See all barkoder-cordova releases on npm →

Continuous scanning, MRZ, VIN and DPM in Cordova

Each mode is a few calls on the same Barkoder object. The snippets come from the Cordova examples in the barKoder docs.

Continuous scanning

Keep the camera session open

Scan item after item without restarting the scanner. The duplicate threshold decides what happens with repeats: -1 reads each barcode once, 0 reads it again with no delay, and a value above 0 waits that many seconds.

JavaScript
                Barkoder.setCloseSessionOnResultEnabled(false);
                Barkoder.setThresholdBetweenDuplicatesScans(0); // it can take values -1, or n > 0
              
Enable continuous scanning in Cordova →

MRZ scanning

Passports, ID cards and visas

One line turns the plugin into a Cordova MRZ and ID scanner. It reads the machine-readable zone of travel and identity documents and returns data such as name, nationality, passport number and expiration date.

JavaScript
                Barkoder.setBarcodeTypeEnabled(BarcodeType.idDocument, true);
              
Enable MRZ mode in Cordova →

VIN scanning with OCR fallback

Code 39, Code 128, Data Matrix and QR

A VIN can be printed in four barcode types. The SDK reads the barcode first. With OCR enabled on your license, it falls back to the printed characters when the barcode can't be decoded. OCR VIN is available from version 1.6.7.

JavaScript
                Barkoder.setEnableVINRestrictions(true);
              
Enable OCR VIN support in Cordova →

DPM mode

Codes etched or printed on parts

Direct Part Marking puts a Data Matrix code straight onto metal or plastic, without a label. The DPM setup enables Data Matrix with DPM mode, slow decoding, FHD resolution and a small region of interest.

JavaScript
                Barkoder.setBarcodeTypeEnabled(BarcodeType.datamatrix, true);
                Barkoder.setDatamatrixDpmModeEnabled(true);
                Barkoder.setDecodingSpeed(DecodingSpeed.slow);
                Barkoder.setBarkoderResolution(BarkoderResolution.FHD);
                Barkoder.setRegionOfInterest(40, 40, 20, 10);
                Barkoder.setRegionOfInterestVisible(true);
              
See the Cordova DPM mode example →

South African driving licenses

PDF417 with on-device parsing

Enable PDF417 and the SA DL formatting type to parse South African driving licenses. Two custom options add parsing for South African ID cards and vehicle license discs.

JavaScript
                Barkoder.setBarcodeTypeEnabled(BarcodeType.pdf417, true);
                Barkoder.setFormattingType(FormattingType.sadl);
              
Enable the South African driving license parser in Cordova →

Damaged and difficult barcodes

The same decoding engine as the native SDKs

  • MatrixSight® reads QR and Data Matrix codes with missing finder, timing or alignment patterns.
  • Segment Decoding® reads 1D barcodes on curved or irregular surfaces such as bottles and test tubes.
  • DeBlur reads EAN and UPC codes with motion, lens or focus blur.
  • PDF417-LineSight® reads PDF417 barcodes with missing start or stop patterns and data columns.
  • Batch MultiScan reads several barcodes at once, with a results limit and result caching.
  • AR Mode draws boxes and barcode status on the camera preview.
  • Gallery scan decodes BMP, PNG and JPG images with scanImage.

Where the Cordova plugin runs

barkoder-cordova wraps the native Android and iOS SDKs, so your web code gets the same decoding as a native app.

Targets and requirements

  • Cordova Android and iOS platforms, added with cordova platform add.
  • Node.js and npm, Xcode on macOS for iOS, and Android Studio for Android.
  • Minimum OS declared by the plugin: Android 5.0 (API 21). iOS 15.0 for version 1.7.2, iOS 12.0 up to 1.7.1.
  • Camera: at least 1280×720. Devices with an 8 MP autofocus camera are recommended.
  • Scanning runs on the device. The SDK goes online only for the license check, and each device must reach the licensing server at least once every 30 days.

Barcode types

1D barcodes

Codabar, Code 11, Code 25, Code 32, Code 39, Code 93, Code 128, COOP 2 of 5, Datalogic 2 of 5, GS1 DataBar, GS1 Composite, EAN-8, EAN-13, IATA 2 of 5, Interleaved 2 of 5, ITF-14, Matrix 2 of 5, MSI Plessey, Postal Barcodes, Telepen, UPC-A, UPC-E and UPC-E1.

2D barcodes

Aztec Code, Aztec Compact, Data Matrix, DotCode, MaxiCode, PDF417, Micro PDF417, QR Code and Micro QR Code.

See all supported barcode types →

Scanning in a browser or PWA instead? The Cordova plugin targets native builds. For the browser, use the Web Barcode Scanner SDK (WASM). For other cross-platform stacks, see the cross-platform barcode SDK overview.

One scanning engine for Cordova, Capacitor, native and web

The engine behind barkoder-cordova also ships as native, web, desktop and cross-platform SDKs, so the same decoding runs in every app you build.

  • 7 native & desktop SDKs
  • 6 cross-platform integrations
  • One consistent scanning core

Teams that replaced their scanner and kept shipping

Migrations and cross-platform rollouts from barKoder customers.

inexto

Switzerland · Track and trace

Migrated from Cognexfor DPM scanning on industrial mobile computers

Uses barKoder in two factory and logistics track-and-trace projects on devices such as the Zebra TC series, and lists wide platform support among its reasons.

What truly made us choose barKoder was the simplicity of integration and high performance in DPM barcode scanningNicolas Schaefer, Head of R&D, inexto
Read the story →

Lotos Tourist by Datalab Montenegro

Montenegro · Tourism guest registration

Less than a dayto fully implement the SDK

Chose barKoder for MRZ scanning in the Lotos Tourist app after testing both open-source and commercial alternatives, for consistent results on Android and iOS, including older devices.

Read the story →

WayMark Infotech

South Africa · Voter registration

Up to 80%faster registration processing

Reads PDF417 and MRZ data on an Android app and a React web portal, with offline scanning in remote areas and 500 licenses deployed.

barKoder's PDF417 scanning accuracy and cross-platform reliability exceeded our expectations.Paul Sentle, WayMark Infotech
Read the story →

Try barKoder on your phone or in your browser

Install the free barKoder demo app, or open the web demo, and scan your own barcodes before you integrate the SDK.

iPhone and iPad

barKoder demo app for iOS

Scan with your camera, or point it at the QR code to open the App Store.

Download on the App Store
QR code linking to the barKoder demo app on the App Store

Android phones and tablets

barKoder demo app for Android

Scan with your camera, or point it at the QR code to open Google Play.

Get it on Google Play
QR code linking to the barKoder demo app on Google Play

Any modern browser

barKoder web demo

Runs the Web SDK in your browser, on desktop or mobile, with nothing to install.

Open the web demo
QR code linking to the barKoder web demo

Test with known samples. Print or display the testing sheet and scan each 1D and 2D barcode with the demo app. The data sheet summarizes the SDK for your team.

Cordova and Ionic barcode scanner questions

What is the best barcode scanner SDK for Cordova?

It depends on what you scan. For occasional QR codes in good light, a free plugin can be enough. If your users scan damaged, blurred or engraved barcodes, passports and ID cards, VINs or many barcodes at once, test a commercial SDK such as barKoder on your own samples and devices. Compare successful reads, how often a code has to be repositioned, and whether the plugin is still updated.

Is phonegap-plugin-barcodescanner still maintained?

No. The package is marked deprecated on npm and its GitHub repository was archived in August 2020. The Ionic Native wrapper @awesome-cordova-plugins/barcode-scanner depends on it and is flagged as deprecated too. cordova-plugin-barcodescanner has had no release since February 2018. The migration steps on this page show how to move to barkoder-cordova.

Does barKoder work as an Ionic Cordova barcode scanner?

Yes. Ionic apps that run on Cordova install barkoder-cordova with ionic cordova plugin add barkoder-cordova, and Ionic Angular projects can use the @awesome-cordova-plugins/barkoder wrapper. Ionic apps that run on Capacitor use barkoder-capacitor, described on the Capacitor Barcode Scanner Plugin page.

Which Android and iOS versions does barkoder-cordova support?

The plugin builds for Android and iOS. Its Android library declares Android 5.0 (API 21) as the minimum. The iOS framework declares iOS 12.0 up to version 1.7.1 and iOS 15.0 in version 1.7.2. Check the barkoder-cordova package on npm for the current release.

Can I scan QR codes, ID documents and driver's licenses in a Cordova app?

Yes. QR Code and Micro QR Code are among the supported 2D types. Enable the idDocument type to read the MRZ on passports, ID cards and visas, and use the SA driving license parser example for South African licenses, ID cards and vehicle license discs. barKoder reads barcodes and MRZ. It is not a general document scanner, and its OCR is built for VIN recognition.

Should I move my Cordova app to Capacitor first?

You don't have to. barKoder publishes plugins for both, with the same scanning engine and the same method names. The Capacitor plugin passes parameters as objects. Stay on barkoder-cordova while your app runs on Cordova. If you migrate to Capacitor later, switch to barkoder-capacitor at that point.

Does scanning need an internet connection?

Only for the license check. The SDK checks the license key with the barKoder licensing server when the app initializes it. All scanning runs on the device, and each device must reach the licensing server at least once every 30 days to keep returning licensed results.

How does the free trial work?

Get a key on the trial page or in the barKoder portal. A trial license lasts 30 days and can be deployed to up to 25 devices, and it is meant for development and staging. Integration and testing support is free.

Add barcode scanning to your Cordova or Ionic app

Install barkoder-cordova and test it on your own barcodes and devices with a free 30-day trial, or talk to an SDK expert about your migration.