camera-samples
camera-samples copied to clipboard
BarcodeScanner implements LifecycleObserver, but close is called manually
Assuming, that the idea of samples is to show best practice of using ML KIT sdk, I would suggest to replace manual call to .close() by lifecycle.addObserver(barcodeScanner).
https://github.com/android/camera-samples/blob/de8b23595d3156a21b6cba53a79b502a46c90ff0/CameraX-MLKit/app/src/main/java/com/example/camerax_mlkit/MainActivity.kt#L108
However if there is a reason not to do so - could you please explain it either in readme or via the comment in the code for clarity.