Redth / ZXing.Net.Maui

Barcode Scanning for MAUI?
MIT License
482 stars 154 forks source link

BarcodesDetected fires twice upon reading the barcode - .NET MAUI android app #110

Open mach-9 opened 1 year ago

mach-9 commented 1 year ago

I've added in the barcode scanning code to my .NET Maui android application, followed all of the instructions, and the BarcodesDetected event fires twice upon scanning.

What I need to do is capture the value, and then navigate to another page (pass the result value). I have two windows that open as noted above, it fires twice.

Is there a way to have it fire only once?

Thank you.

IDE: Visual Studio 2022 V. 17.4.5 Platform Target Frameworks: .NET FW 4.7, Support 7.0 Android: Android 12.0 API 31 NuGet Packages: Latest ZXing.NET.Maui packages Affected Devices: Using Samsung S10 phone

be-swarm commented 1 year ago

Same problem. Framework .net 7.0

adrianotrentim commented 1 year ago

I solved this problem with a check on a boolean variable. On the first call, I check if this variable is false, and then I set it to true, and I no longer process subsequent requests.

mach-9 commented 1 year ago

Thanks for this.