Skip to main content

Getting started with the Kotlin Multiplatform Barcode Scanner SDK's Compose UI

Integrating the Compose UI Components

The KMP SDK provides a Compose-based BarcodeScannerCustomUI component that encapsulates the barcode scanning feature in one reusable composable. This component handles camera access, barcode detection, and visual overlays out of the box.

Integration

For an example of a complete integration of the Kotlin Multiplatform Barcode Scanner, please refer to our scanbot-barcode-scanner-sdk-example-kmp repository on GitHub.

Adding the feature as a dependency

To use BarcodeScannerCustomUI, add the Scanbot Compose UI dependency to your KMP project:

app/build.gradle.kts
commonMain.dependencies {
implementation("io.scanbot:kmp-compose-ui-barcode-sdk:$scanbotSdkVersion")
}

Initializing the SDK

Before using the Scanbot SDK, it must be initialized in your application. For more details on how to initialize the SDK, please refer to the initialization guide.

Using BarcodeScannerCustomUI

To start using the barcode scanner, add the BarcodeScannerCustomUI composable to your screen:

Basic Barcode Scanner View
loading...

Main configuration

The Scanbot SDK provides the ability to configure the barcode scanner through BarcodeScannerCustomUI configurations and BarcodeScannerConfiguration. There are two ways of doing this: simplified and advanced.

Simple configuration

Here is an example of a simple configuration modification:

Simple configuring Barcode Scanner
loading...

It provides a straightforward way to configure barcodeFormatConfigurations, extractedDocumentFormats, and onlyAcceptDocuments.

Advanced configuration

For more detailed configuration, you can use the advanced way:

Advanced configuring Barcode Scanner
loading...

For the full list of parameters, please refer to the BarcodeScannerConfiguration.

Common configuration

Some use cases require special handling. For example, it is possible to configure the barcode scanner to scan only barcodes of pre-defined lengths. This might reduce the number of false scans. Such parameters work only for enumerated types of barcodes and usually you don't need to modify their default values.

You can specify these parameters via the BarcodeFormatCommonConfiguration entity as a part of BarcodeScannerConfiguration:

Configuring BarcodeFormatCommonConfiguration
loading...

For the full list of parameters, please refer to the BarcodeScannerConfiguration.

Camera configuration

Configuring Camera
loading...

For the full list of parameters, please refer to the BarcodeCameraConfiguration.

Finder view configuration

Customize the finder overlay appearance and behavior:

Configuring Finder View
loading...

For the full list of parameters, please refer to the FinderViewConfiguration.

AR Overlay configuration

Add visual overlays to detected barcodes with AR-style highlighting:

Configuring Selection Overlay
loading...

For the full list of parameters, please refer to the ArOverlayConfiguration.

Custom overlay for individual barcodes

Customize the overlay for each barcode individually.

Custom Barcode Overlay
loading...

Handling scan results

Handling the Result
loading...

Want to scan longer than one minute?

Generate a free trial license to test the Scanbot SDK thoroughly.

Get free trial license