Closed DaveDaBrave closed 2 months ago
Hello.
I've taken a quick look at your example on an Android 11 emulator as I don't have a device with this version on hand. I've noticed a few things:
await Methods.AskForRequiredPermissionAsync();
is missing. Camera won't start without it.Border
didn't work whatever I did.Frame
worked when HeightRequest
was set to some fixed value (for example 300) or if Grid.RowDefinitions
were set to fixed value. In my experience this is a broader MAUI problem as I had problems with calculated values on Grid
with other controls in the past.cameraView.Handler?.DisconnectHandler();
to prevent memory leaks. Readme has an example.I really don't know why is Frame
working and Border
isn't... Maybe someone can chime in and help...
Thanks for your reply. In the main project we have the permissions request, in the sample project I shortly granted permission via the app settings from the home screen - sorry for forgetting to mention that. We'd like to not set a fixed height, but let the Border use any available height the several device screens offer using the layout. I will have a closer look at the call of cameraView.Handler?.DisconnectHandler(); not quite sure if that helps as needed, but I will try and let you know. Would be nice if anybody has a clue how to solve that, on that side MAUI has still a lot of problems and needed workarounds to be done by us.
Just to give you a heads-up I think I found a solution to this problem. Although official AndroidX documentation mentions:
Use a SurfaceView for the preview when possible.
it looks like the solution is to set PreviewView ImplementationMode to Compatible, which uses TextureView as it integrates seamlessly to the UI hierarchy and it looks like this fixes the problems with the layout. But it has some drawbacks, mainly slower performance.
I'll give it a few more days to test and if everything goes well I'll publish a new release.
That sounds promising. Could you provide a preview NuGet of that possibly fix? Then I can also test that on our side.
Thanks for the NuGet Update, that fixed the problems on our side.
I added the library to our app for a .NET MAUI App on iOS and Android. On Android we have issues only on Android 11, above versions work fine. Depending on where the camera gets enabled in code behind (in OnAppearing or OnNavigatedTo) several different UI issues are happening. A reproduction project and screenshots are attached. Some comments with descriptions which screenshot matches which case of implementation are within ScanPage.xaml.cs and in ScanPage.xaml are the 2 versions of surrounding UI elements for the CameraView. Hope you can help me out. BarcodeScanningIssue.zip