Skip to content

Instantly share code, notes, and snippets.

@DUMA042
Created January 10, 2025 22:54
Show Gist options
  • Save DUMA042/009b758ec5bbfaf44eb0420531e860cc to your computer and use it in GitHub Desktop.
Save DUMA042/009b758ec5bbfaf44eb0420531e860cc to your computer and use it in GitHub Desktop.
cameraController.setImageAnalysisAnalyzer(
ContextCompat.getMainExecutor(ctx), // Use the main thread for analysis
MlKitAnalyzer(
listOf(barcodeScanner), // Pass the barcode scanner
ImageAnalysis.COORDINATE_SYSTEM_VIEW_REFERENCED, // Use view-referenced coordinates
ContextCompat.getMainExecutor(ctx) // Use the main thread for results
) { result: MlKitAnalyzer.Result? ->
// Process the barcode scanning results
val barcodeResults = result?.getValue(barcodeScanner)
if (!barcodeResults.isNullOrEmpty()) {
// Handle detected barcodes
}
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment