Development of Barcode Search in Mobile Application
Barcode search is not just "scanned and found". This pipeline: image capture → recognition → backend or local database query → result display. Each step can be bottleneck, and most often problems arise not in scanning, but what happens after.
Platform capabilities for recognition
iOS: AVFoundation with AVMetadataObjectTypeEAN13Code, UPCA, QRCode and dozen more types. Or VisionKit — VNDetectBarcodesRequest with VNBarcodeObservation, more convenient for processing static images from gallery. DataScannerViewController (iOS 16+) — simplest path: one class, built-in UI, all types support from box.
Android: ML Kit Barcode Scanning (com.google.mlkit:barcode-scanning) — works offline, supports 1D and 2D codes. Or ZXing — proven library, but significantly slower on weak devices than ML Kit.
Choice depends on minimum OS version and offline requirements. ML Kit on Android requires Google Play Services; on devices without GMS (Huawei) need bundled model.
What's really hard: search, not scanning
Scanning itself — few lines of code. Complexity in search architecture:
Result deduplication. Camera recognizes same barcode dozens times per second. Without debounce request goes to server 50 times before user removes camera from shelf. Solution: throttle on last recognized code with 800ms-1s delay.
Offline search. If product catalog available locally, search by SQLite or Room (Android) / CoreData (iOS) by barcode field with index works instantly. Without index on 100k products table — 300-500ms even on flagship.
Unknown code. What to show if barcode not found in database? Fallback to Open Food Facts API, GS1 lookup, or just message? Product decision, but need to lay in architecture early — else redesign flow.
Example: debounce search on iOS
private var lastScannedCode: String?
private var searchTimer: Timer?
func handleScannedCode(_ code: String) {
guard code != lastScannedCode else { return }
lastScannedCode = code
searchTimer?.invalidate()
searchTimer = Timer.scheduledTimer(withTimeInterval: 0.8, repeats: false) { [weak self] _ in
self?.performSearch(barcode: code)
}
}
Barcode types and handling
| Type | Application | Note |
|---|---|---|
| EAN-13 / UPC-A | Retail products | GS1 standard |
| Code 128 | Logistics, warehouse | Arbitrary text |
| QR Code | Links, payments | Up to 4096 bytes |
| Data Matrix | Medications | Small size |
| ITF-14 | Group packaging | Digits only |
If tech spec doesn't specify exact types — clarify upfront. Including all types support without need slows recognition.
Development timeline: 1-3 days. Cost calculated individually after clarifying code types and search architecture.







