Android Question Has anyone used Camera2 / CameraEx2 for Barcode scanning?

Ian Garton

Licensed User
Longtime User
Hello. I know the camera library and CameraEx class can be used to access the Google Vision barcode scanning, however has anyone done this with the Camera2 library?

I'm having issues with particular Samsung devices not detecting barcodes with the camera library, and want to check with camera2.


B4X founder
Staff member
Licensed User
Longtime User
Google Vision isn't directly related to the camera. It receives an image and analyzes it.

The relevant code is:
frameBuilder.RunMethod("setImageData", Array(bb, cs.Width, cs.Height,  842094169))

The three supported formats are NV16 (16), NV21 (17) and YV12 (842094169).
Maybe your camera returns a different preview format. Try it with the two other values.
Upvote 0