Posted by Donovan McMurray, CameraX Developer Relations Engineer
val options = BarcodeScannerOptions.Builder()
.setBarcodeFormats(Barcode.FORMAT_QR_CODE)
.build()
val barcodeScanner = BarcodeScanning.getClient(options)
cameraController.setImageAnalysisAnalyzer(
executor,
new MlKitAnalyzer(List.of(barcodeScanner),
COORDINATE_SYSTEM_VIEW_REFERENCED,
executor, result -> {
// The value of result.getResult(barcodeScanner)
// can be used directly for drawing UI overlay.
}
)