BarcodeScanner.Mobile icon indicating copy to clipboard operation
BarcodeScanner.Mobile copied to clipboard

Why is the camera blocked for barcodescanner after taking photo

Open DavidStania opened this issue 3 years ago • 0 comments

Hi all,

I'm a little bit confused cause I would like to scan barcodes with this library and after that, taking one or more photos with the camera.

You can use this repo and add a new button in the MainPage and use the following eventhandler in the code behind.

        private async void Button_Clicked_8(object sender, EventArgs e)
        {
            var status = await Permissions.RequestAsync<Permissions.Camera>();
            if(status == PermissionStatus.Granted)
            {
                var photo = await MediaPicker.CapturePhotoAsync(new MediaPickerOptions { Title = "Give me a smile" });
                if (photo != null)
                {
                    // ... 
                } 
            }
        }

After making a few photos, try to use the barcodescanner again. It will fail! The camera view is black. I don't know why! Sometimes it happens after 2 times, sometimes after first time.

On my old Android 10 it works like expected. On my Android 11, it fails like described.

Any ideas?

DavidStania avatar Dec 01 '22 20:12 DavidStania