philipplackner/QrCodeScannerCompose

com.google.zxing.NotFoundException when trying to scan the qrcode

Closed this issue · 2 comments

Hi Philip,

I clone this project and try to test it on my pixel 4 xl. But for some reason, I am getting com.google.zxing.NotFoundException exception when I try to scan the QR code. Let me know if you want me to provide more details.

I think I figure it out. We just need to adjust the size of the target resolution instead of using taking the full width and height.

Old implementation:

val imageAnalysis = ImageAnalysis.Builder()
                        .setTargetResolution(
                            Size(
                                previewView.width,
                                previewView.height
                            )
                        )
                        .setBackpressureStrategy(STRATEGY_KEEP_ONLY_LATEST)
                        .build()

New implementation:

val imageAnalysis = ImageAnalysis.Builder()
                        .setTargetResolution(
                            Size(
                                700,
                                500
                            )
                        )
                        .setBackpressureStrategy(STRATEGY_KEEP_ONLY_LATEST)
                        .build()

tested and works fine on pixel 4XL

Thank you for your fix it works perfectly !