mlkit icon indicating copy to clipboard operation
mlkit copied to clipboard

[Barcode Scanner] Open again the camera scanning

Open satriawarn opened this issue 4 years ago • 6 comments

How to open again the camera after success get 1st raw value, I found addOnSuccessListener but i don't know how to open camera 2nd time.

Mobile environment Android

satriawarn avatar Jan 28 '22 15:01 satriawarn

ML Kit SDK doesn't control when to open or close the camera.

Do you mean the camera is closed automatically after first successful scan? Do you use ML Kit sample App or your own? If your own, can you provide some code snippet.

zhouyiself avatar Jan 29 '22 00:01 zhouyiself

can you share the code of the function handling it.

zekst avatar Jan 29 '22 07:01 zekst

I'm using ML Kit from this , here's my code

Activity : image And i put startCamera in onCreate, I try to open camera again after get the barcode string. The camera doesn't close but i can't get another barcode.

BarcodeAnalyzer: image

satriawarn avatar Jan 29 '22 09:01 satriawarn

yeah i am looking on it

zekst avatar Jan 31 '22 04:01 zekst

I'm not sure if you do the camera unbinding & binding at the right place, maybe you can take a look at ML Kit's Camerax sample usage. https://github.com/googlesamples/mlkit/blob/master/android/vision-quickstart/app/src/main/java/com/google/mlkit/vision/demo/kotlin/CameraXLivePreviewActivity.kt

zhouyiself avatar Feb 03 '22 19:02 zhouyiself

Closing due to no activity, please reopen if needed.

zhouyiself avatar Mar 02 '22 08:03 zhouyiself