Skip to content

Android camera black screen #67

Open

Description

@Martinchr82

When I first arrive to the Page with the QR scanning, everything is working perfectly. I can also navigate to another page and come back to successfully scan again. But if I navigate to another page from a bottom tab and come back to the page, then the camera screen is black on Android (Samsung S8, OS 9). Everything is working on iOS

The project is created with VS 2022 Preview 17.4.0 Preview 4.0, using net. 6

https://github.com/Martinchr82/MauiQRScanning.git

Activity

  1. ggamez4 commented on Nov 15, 2022

    @ggamez4

    I am having the same issue with this only on Android. Only when scanning QR Codes, when scanning any other type of barcode, this issue does not occur.

    My project is running VS for Mac 2022 Preview 17.5 Preview 1, using .NET 7

  2. Phenek commented on Nov 23, 2022

    @Phenek

    I am experiencing a similar issue, on a modal page, on a real device.
    On simulator I can see the virtualize camera perfectly.

  3. programatix commented on Dec 16, 2022

    @programatix

    I'm having this issue when the CameraBarcodeReaderView is placed inside a page as an AppShell TabBar page. Upon navigating out from the page with CameraBarcodeReaderView and back, the view is black.

    The workaround is to switch to rear camera and back to front (and vice versa). I think it has something to do with the camera initialization. It would be great if we could manually stop and start the camera.

    Actually this happen to https://github.com/JimmyPun610/BarcodeScanner.Mobile.

  4. a7son commented on Dec 24, 2022

    @a7son

    I am experiencing a similar issue, on real device with tabbedpage as my main page..
    when i go back to barcode page, it goes black screen..
    i should go back to my login page and relogin, and the trouble was gone..
    Im using .NET 7

  5. golovko commented on Jan 3, 2023

    @golovko

    Same issue. Found a kinda workaround, re-initializing the camera by switching front/rear cameras:
    protected override async void OnAppearing() { cameraBarcodeReaderView.CameraLocation = CameraLocation.Front; cameraBarcodeReaderView.CameraLocation = CameraLocation.Rear; }

  6. Quaybe commented on Jan 6, 2023

    @Quaybe

    The workaround is to switch to rear camera and back to front (and vice versa). I think it has something to do with the camera initialization. It would be great if we could manually stop and start the camera.

    Actually this happen to https://github.com/JimmyPun610/BarcodeScanner.Mobile.

    Completely agree, there would be a lot of value added to being able to manually start and stop the camera. I'm trying to have the camera become visible in the same view as my other controls, over the top of them. But even if I have IsVisible=False IsEnabled=False, the camera is still active when the page loads, and I'm still prompted for permissions even though I'm not trying to use the camera just yet.

    BarcodeScanner.Mobile seems promising but doesn't support .NET 7 it seems

  7. Yo0oo0oY commented on Feb 16, 2024

    @Yo0oo0oY

    The solution to the issue of the screen turning black after the phone is locked and unlocked again.

  8. daerogami commented on Nov 20, 2024

    @daerogami

    This used to work on my Android 9 (API 28) phone, now I am getting a black-screen. It still scans, but throws a "Value out of range exception" when it does. The above workarounds do not work, I am on the latest .NET 8 MAUI packages.

    I can confirm it still works on Android 12+ and iOS 15+ physical devices, emulators, and simulators.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions