Redth / ZXing.Net.Mobile

Barcode Scanner for Xamarin.iOS, Xamarin.Android, UWP and Tizen
MIT License
1.07k stars 701 forks source link

Autofocus issues on Android #1012

Open duncancole opened 3 years ago

duncancole commented 3 years ago

I've been running into repeated issues with the camera not auto focusing on Android. Tap to focus works but otherwise it will stay at the focus level of whatever it was pointing at when the screen was opened. The one exception to this is if you push another page on top of the scanning page and then dismiss it then the camera will auto focus correctly as you move around to look at items closer and farther away.

volkan-akkus-tr commented 1 year ago

Maybe, don't use a ScannerPage. Use their MobileBarcodeScanner. As Igor Kravchenko stated at https://stackoverflow.com/a/66296505/20395535

ZXing.Mobile.MobileBarcodeScanner scanner = new();
ZXing.Result result = await scanner.Scan().ConfigureAwait(false);

if (result != null && !string.IsNullOrWhiteSpace(result.Text))
{
    // result.Text is ready.
}

Kudos to Igor.