Android SDK

Android Barcode Scanner SDK

Add barcode scanning to Android apps with the native barKoder SDK for Kotlin and Java. It reads 1D and 2D barcodes, supports continuous scanning and Batch MultiScan, decodes damaged and difficult barcodes, and handles VIN, MRZ, PDF417 and DPM workflows.

Android barcode scanner SDK: Android logo with a barKoder QR code

Native Android Barcode Scanner SDK for Kotlin and Java

The barKoder Android SDK is a native barcode scanning library that runs on the device. You add it to your Android Studio project as a Gradle module, place a BarkoderView in your layout and call it from Kotlin or Java. The same engine reads common retail barcodes and the hard cases: damaged labels, DPM marks, MRZ on passports and many barcodes at once.

What the Android barcode SDK reads

  • 30+ 1D and 2D symbologies
  • QR Code and Data Matrix
  • Damaged and blurry barcodes
  • Deformed 1D barcodes
  • Batch MultiScan
  • Continuous scanning
  • VIN barcodes and VIN text
  • MRZ on passports and IDs
  • PDF417 on licenses and IDs
  • DPM Data Matrix
  • DotCode
  • Barcodes in gallery images

Test it on the barcodes your users actually scan. A trial license covers 25 devices for 30 days.

Start a free trial

Add an Android barcode scanner to your app

  1. Import the barkoder module (Groovy DSL) or copy barkoder.aar into app/libs (Kotlin DSL), then add the dependency.
  2. Add BarkoderView to the layout of the activity or fragment that scans.
  3. Create a BarkoderConfig with your license key, or apply a ready-made template.
  4. Implement BarkoderResultCallback to receive results.
  5. Call startScanning.
Open the Android installation guide

Android barcode scanner: Kotlin example

The minimum code to scan in Kotlin, copied from the barKoder Android installation guide and the GitHub README. The repository also contains a complete Kotlin sample app, BKDSampleKotlin.

1. Add the dependency (Groovy DSL, after importing the barkoder module)
Gradle
          implementation project(path: ':barkoder')
        
Or with Kotlin DSL, after placing barkoder.aar in app/libs (build.gradle.kts, Module :app)
Kotlin
          implementation(files("libs/barkoder.aar"))
        
2. Add BarkoderView to your layout
XML
          <com.barkoder.BarkoderView
          android:id="@+id/bkdView"
          android:layout_width="match_parent"
          android:layout_height="match_parent" />
        
3. Create the config with your license key and apply a template
Kotlin
          bkdView.config = BarkoderConfig(this, "LICENSE_KEY") {
          Log.i("LicenseInfo", it.message)
          }
          BarkoderHelper.applyConfigSettingsFromTemplate(
          this,
          bkdView.config,
          BarkoderConfigTemplate.INDUSTRIAL_1D,
          null
          )
        
4. Receive results with BarkoderResultCallback
Kotlin
          class MainActivity : AppCompatActivity(), BarkoderResultCallback {
          ....
          override fun scanningFinished(results: Array<Barkoder.Result>, thumbnails: Array<Bitmap>, imageResult: Bitmap?) {
          Log.i("Scanned result", results[0].textualData)
          }
          }
        
5. Start scanning
Kotlin
          bkdView.startScanning(this)
        

For a full screen with start and stop buttons, see the Android general example. Every class and method is listed in the Android API reference.

An Android barcode scanner library for difficult codes

Each feature below has its own Android example in the docs. Where the docs give a short setting, it is shown here.

Damaged, deformed and blurry barcodes

MatrixSight®, Segment Decoding, DeBlur

MatrixSight reads QR and Data Matrix codes that are missing their finder, timing or alignment patterns. Segment Decoding reads 1D barcodes that are crumpled, wrinkled or bent so far that a straight line no longer crosses every bar. DeBlur reads EAN and UPC barcodes affected by motion, lens or focus blur.

How Segment Decoding reads deformed barcodes →

Batch MultiScan and continuous scanning

Many barcodes in one session

Keep the session open and read many barcodes of any type and density. Result caching and location reconstruction keep results stable while the phone moves.

Kotlin
              bkdView.config.isCloseSessionOnResultEnabled = false
              BarkoderConfig.SetMulticodeCachingEnabled(true)
              BarkoderConfig.SetMulticodeCachingDuration(3000)
              bkdView.config.decoderConfig.duplicatesDelayMs = 0
              bkdView.config.decoderConfig.maximumResultsCount = 200
            
Enable MultiScan on Android →

MRZ scanner for Android

Passports, ID cards and travel documents

Read the Machine Readable Zone on the device in real time. Results can include the main, document, signature and picture images. The MRZ example has code in both Kotlin and Java; this is the Java line:

Java
              barkoderConfig.getDecoderConfig().IDDocument.enabled = true;
            
Enable MRZ mode on Android →

VIN scanning

Code 39, Code 128, QR Code and Data Matrix

VIN mode combines MatrixSight and Segment Decoding to read the barcodes that carry Vehicle Identification Numbers. Apply the VIN template or set it up by hand. OCR VIN support reads the printed number too.

Kotlin
              bkdView.config.decoderConfig.enableVINRestrictions = true
            
Enable VIN scanning on Android →

PDF417, licenses and boarding passes

PDF417-LineSight® and built-in parsers

LineSight reads PDF417 barcodes that are missing their start and stop patterns, row indicators or whole data columns. The SA DL parser turns South African driving licenses, ID cards and vehicle license discs into fields. A BCBP parser reads IATA boarding passes.

Enable the South African parsers on Android →

DPM Data Matrix on Android

Direct Part Marking

DPM mode reads Data Matrix codes engraved or etched onto parts. The docs recommend slow decoding, Full HD resolution and a region of interest.

Kotlin
              bkdView.config.decoderConfig.Datamatrix.enabled = true
              bkdView.config.decoderConfig.Datamatrix.dpmMode = true
            
See the Android DPM example →

ML Kit, ZXing or a commercial Android barcode scanner SDK

Many Android teams start with Google ML Kit barcode scanning or ZXing. Both are free and work well for many apps. Scandit, Dynamsoft and barKoder are commercial SDKs. Here is how to decide.

ML Kit or ZXing fits when

  • You want a free library
  • Your codes are clean QR codes or common retail barcodes
  • ML Kit's 13 formats cover what you scan, and 10 barcodes per call is enough
  • You accept that ZXing is in maintenance mode, with changes driven by contributed patches

barKoder fits when

  • Labels are damaged, blurred, wrinkled or on curved surfaces
  • Your users scan in low light or on older, lower-end Android devices
  • You read dense PDF417, DPM marks, MRZ or VIN
  • You read many barcodes in one session with Batch MultiScan (the docs example allows 200 results)
  • You need DotCode, MaxiCode, Telepen, MSI Plessey or Code 11
  • You want the same engine on iOS, web and cross-platform frameworks
  • You want direct support from the team that builds the engine

Nasdron moved its Android Track & Trace app from ML Kit to barKoder after ML Kit became unreliable in low light. Whatever you compare, run each SDK on the same samples and devices, and count failed and duplicate reads as well as successful ones.

Requirements and documentation

What you need

  • Android 8.0 (API 26) or later
  • ABIs: arm64-v8a, armeabi-v7a, x86, x86_64
  • Kotlin or Java
  • The barkoder AAR from the GitHub repository, added as a Gradle module or from app/libs
  • A barKoder license key. Without one, the SDK still scans but marks results as unlicensed.

One scanning engine for Android and every other platform

The engine in the Android SDK is also available as a native iOS SDK, a Web SDK and plugins for cross-platform frameworks, so you can reuse the same setup across your apps.

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

barKoder in Android apps

Two teams that run barKoder in Android apps in the field, one after replacing ML Kit.

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.

Android barcode scanner SDK questions

What is the best barcode scanning SDK for native Android?

It depends on what you scan. For clean QR codes and retail barcodes, Google ML Kit may be enough. If your users scan damaged labels, dense PDF417, DPM marks, MRZ or VIN, scan in low light, or read many barcodes at once, test a commercial Android barcode scanner SDK such as barKoder on your own samples with a free trial license.

How do I add the barKoder Android SDK with Gradle?

The SDK ships as an AAR in the barKoder Android GitHub repository. With Groovy DSL, import the barkoder module and add implementation project(path: ':barkoder'). With Kotlin DSL, put barkoder.aar in app/libs and add implementation(files("libs/barkoder.aar")). Both are covered in the Android installation guide.

Can I use the barcode scanner from Kotlin and Java?

Yes. The SDK supports both. The installation guide and the sample app use Kotlin, and examples such as MRZ scanning also show Java code.

How is barKoder different from Google ML Kit barcode scanning?

ML Kit is free and runs on the device. It reads 13 formats and up to 10 barcodes per call. barKoder uses its own engine, with MatrixSight, Segment Decoding, DeBlur and PDF417-LineSight for damaged codes, 30+ symbologies, MRZ, VIN, DPM and Batch MultiScan, plus developer support. barKoder needs a commercial license; see pricing.

Can I replace ZXing or zxing-android-embedded with barKoder?

Yes. Replace the ZXing view or intent with a BarkoderView, enable the barcode types you need and handle results in scanningFinished. The ZXing project describes itself as in maintenance mode. For MRZ, the docs also include a guide for replacing the MRZScanner SDK with barKoder on Android.

Which Android versions and devices are supported?

Android 8.0 (API 26) and later, on arm64-v8a, armeabi-v7a, x86 and x86_64. That covers phones, tablets and rugged Android mobile computers: INEXTO runs barKoder on Zebra TC series devices.

Does the Android barcode scanner work offline?

Scanning runs locally 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.

Is there a free trial, and what happens without a license key?

Without a key the SDK still scans, but results are marked as unlicensed. A trial license covers 25 devices for 30 days. Use trial licenses in development and staging only, and never publish one in a store app.

Add barcode scanning to your Android app

Test barKoder on your own barcodes and Android devices with a free trial, or talk to an SDK expert about your project.