A simple and modern Android barcode scanner app for Zebra devices (like TC21, TC22) using Kotlin, Jetpack Compose, and the DataWedge Intent API. It listens for broadcast intents and displays scanned barcode data in real time.
Note
This is a demo application intended for learning and demonstration purposes only.
- Uses Zebra’s DataWedge to handle scanning — no low-level SDK integration needed.
- Scanned barcodes are broadcasted and captured via a BroadcastReceiver.
- Data is stored in a ViewModel and rendered instantly in the UI with Jetpack Compose.
- Lightweight and easy to integrate.
| File | Purpose |
|---|---|
ScanningConfig.kt |
Defines the intent action and keys for extras. |
ScannerViewModel.kt |
Holds the scanned barcode data and exposes it to the UI using StateFlow. |
ScanBroadcastReceiver.kt |
Listens for broadcast intents from DataWedge and updates the ViewModel. |
AndroidManifest.xml |
Registers the BroadcastReceiver for the scan action. |
-
Broadcast Intent Listening The app listens for the intent action:
com.stankovic.zebrascanner.scanThis is configured in
ScanningConfig.kt. -
Data Extraction When a barcode is scanned, DataWedge sends the data as an intent extra:
com.symbol.datawedge.data_string -
ViewModel and UI Update The
ScanBroadcastReceiverextracts the barcode, updates theScannerViewModel, which then updates the Compose UI in real time.
Important
You have to create a profile after installing this app on the Zebra device!
- Open DataWedge app on the device.
- Click on three dots in top right corner
- Click on
New Profile - Enter any name of your profile
- Click on the profile you just created
- Ensure that the profile is enabled (should be by default)
- Associate that profile with the sample application
- Click on
Associated apps - Click on three dots in top right corner and click on
New app/activity - Scroll in the menu, find
com.stankovic.zebrascannerand click on it. - In the
Select activitymenu choose* - Go back to the profile screen
- Click on
- Ensure that
Barcode inputis enabled - Ensure that
Keystroke outputis enabled - Scroll down to
Intent outputsection - Click on checkbox to enable it
- Click on
Intent actionand entercom.stankovic.zebrascanner.scanaction and click OK.- Intent action must be same as set in
ScanningConfig.ktinAPP_SCANNER_INTENTconstant.
- Intent action must be same as set in
- Click on
Intent deliveryand chooseBroadcast intent
You can simulate a scan using ADB:
adb shell am broadcast -a com.stankovic.zebrascanner.scan -e com.symbol.datawedge.data_string "123456789" -e com.symbol.datawedge.source scanner -e com.symbol.datawedge.label_type EAN13
This command mimics a scan so you can test without a physical Zebra device.
For a detailed step-by-step explanation and implementation guide, check out the full Medium article.
Implementing Zebra Scanner in Kotlin with Jetpack Compose & DataWedge API