QR code scanning via camera in mobile app

NOVASOLUTIONS.TECHNOLOGY is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.
Development and support of all types of mobile applications:
Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1 servicesAll 1735 services
QR code scanning via camera in mobile app
Simple
~1 business day
FAQ
Our competencies:
Development stages
Latest works
  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    756
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    624
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1050
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    947
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    862
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    445

Implementing QR Code Scanning via Camera in Mobile Applications

DataScannerViewController in iOS 16+ made QR scanner implementation a trivial task — approximately 20 lines of code. On Android, ML Kit handles it similarly. The main work is UX around the scanner: lighting, animation, camera access error handling.

iOS: Two Approaches

DataScannerViewController (iOS 16+)

guard DataScannerViewController.isSupported,
      DataScannerViewController.isAvailable else { return }

let scanner = DataScannerViewController(
    recognizedDataTypes: [.barcode(symbologies: [.qr])],
    qualityLevel: .balanced,
    recognizesMultipleItems: false,
    isHighlightingEnabled: true
)
scanner.delegate = self
try? scanner.startScanning()
present(scanner, animated: true)

recognizesMultipleItems: false — stops at the first code found. isHighlightingEnabled draws a frame around the code automatically.

Delegate:

func dataScanner(_ dataScanner: DataScannerViewController,
                 didAdd addedItems: [RecognizedItem],
                 allItems: [RecognizedItem]) {
    guard case let .barcode(barcode) = addedItems.first,
          let payload = barcode.payloadStringValue else { return }
    dataScanner.stopScanning()
    handleQR(payload)
}

AVFoundation (iOS 14-15)

For iOS 14-15 support — AVCaptureMetadataOutput with metadataObjectTypes = [.qr]. Detailed implementation is the same as for general barcode scanning.

Android: ML Kit in 10 Lines

val options = BarcodeScannerOptions.Builder()
    .setBarcodeFormats(Barcode.FORMAT_QR_CODE)
    .build()
val scanner = BarcodeScanning.getClient(options)

Through CameraX ImageAnalysis — same approach as general barcode scanning. Specifying the exact format FORMAT_QR_CODE speeds up recognition roughly twofold compared to FORMAT_ALL_FORMATS.

What Really Takes Time: UI Around the Scanner

Scanning overlay with reticle. Standard pattern — semi-transparent overlay with transparent rectangle in center. On iOS: CAShapeLayer with evenOdd fill rule or SwiftUI Canvas. On Android: custom View with PorterDuff.Mode.CLEAR.

Scanning line animation. Users expect a moving line — without it, unclear if process is active. Simple CABasicAnimation on iOS or ObjectAnimator on Android.

Flashlight. Torch toggle: on iOS AVCaptureDevice.torchMode = .on, on Android CameraControl.enableTorch(true).

Camera permission. If user declined the request, standard flow: AVCaptureDevice.authorizationStatus(for: .video) == .denied → "Open Settings" button → UIApplication.shared.open(URL(string: UIApplication.openSettingsURLString)!). On Android — ActivityCompat.shouldShowRequestPermissionRationale() for explanation.

Implementation timeline: 1 day (basic function) — 2 days (with custom UI and handling all edge cases). Cost calculated individually.