Select to view content in your preferred language

.NET MAUI, Android: Map is not shown when navigated back to map-page

7825
22
Jump to solution
06-27-2023 10:34 AM
Labels (3)
SokoFromNZ
Frequent Contributor

Hi,

Since day one I have basically the same issue as described here: https://community.esri.com/t5/net-maps-sdk-questions/net-maui-map-not-loading-for-the-second-time/m-...

The issue persits on Android (emulator and real device). On Windows it is OK. iOS I cannot test.

See the attached example solution for your convenience (I'm using latest VS v17.6.4). 

Please provide a valid license and Apikey in MauiProgram.cs before starting...

The app starts like this:

SokoFromNZ_0-1687886895825.png

 

Then use the lower tab buttons to switch to the "Note" page:

SokoFromNZ_1-1687886922979.png

 

Switching back to the "Map" page shows the watermark, but now map:

SokoFromNZ_3-1687886971583.png

 

If you just move the finger on the "empty" map, it appears again.

 

I reckon it is a Maui bug...as most of the issues we are having 😞

But I haven't found any workaround yet and my customer gets really annoyed by this bug now as it is in our app since day one and Maui does not seem to improve.

Would be great if you can give me a little insight on this behaviour and maybe let me know a workaround.

Thanks

Soko

0 Kudos
22 Replies
esp1rl
by
Occasional Contributor

That's correct. I found this issue to occur for all Android, iOS and Windows

0 Kudos
SokoFromNZ
Frequent Contributor

The original issue of my opening post is not solved by this though. It is for the GPS issue only.

esp1rl
by
Occasional Contributor

I use this one to fix the fact that the MapView isn't redrawn when COMING from another tab. This is a separate issue from the rendering engine locking up when switching TO another tab.

    private void PageNavigatedTo(object _, NavigatedToEventArgs __)
    {
#if ANDROID
        /* ISSUE: This is a workaround for a bug in ArcGIS Maps SDK where the MapView is not redrawn on tab change
         *
         * https://community.esri.com/t5/net-maps-sdk-questions/net-maui-android-map-is-not-shown-when-navigated/m-p/1303488
         */
        MapView.InvalidateMeasureNonVirtual(Microsoft.Maui.Controls.Internals.InvalidationTrigger.Undefined);
#endif
    }

 

esp1rl
by
Occasional Contributor

Setting LocationDisplay.ShowPingAnimationSymbol = false also reduces the chance of this issue occuring as the renders are completed much faster.

I also suggest adding a time based exit to the while loop so that one doesn't risk locking the UI thread forever.

0 Kudos
SokoFromNZ
Frequent Contributor

@esp1rl wrote:

I also suggest adding a time based exit to the while loop so that one doesn't risk locking the UI thread forever.


Thats exactly what my user are reporting at the moment: The UI thread freezes as DrawStatus never changes anymore.

Did you implement a time based exit yet? Having such a thing prevents the lock of course, but after that the map is still white/empty once going back to the page.

So I'm not sure if this solution of yours does help in the end...

0 Kudos
dotMorten_esri
Esri Notable Contributor

Could you please retry with the latest v200.3. I believe this issue should be fixed in that release.

0 Kudos
SokoFromNZ
Frequent Contributor

Is there a way to use v200.3 with .NET7? Why do you force .NET8 on us with this update? We cannot move to .NET8 at the moment with our product.

0 Kudos
dotMorten_esri
Esri Notable Contributor

We made the decision to move to .NET 8, because .NET 7 support lifecycle ends already in Spring 2024, and we've observed numerous critical bug fixes in the new version of MAUI.


This is also on par with the plans announced over the last few years, where we always move to the latest LTS version of .NET (which meant two years on .NET 3.1, then two years on .NET 6, now two years on .NET 8, before moving to .NET 10 etc. Also note that .NET MAUI by itself is on a more aggressive support lifecycle than the rest of .NET is, and for instance already dropped support for .NET 6 in the spring).

0 Kudos
SokoFromNZ
Frequent Contributor

"...numerous critical bug fixes..." tell me about it 😉

So there is no trick (or beta version of your v200.3) which I can use on .NET7, am I right?

We will upgrade to .NET8 in Q1 of 2024. W've tried already but there where a lot of breaking changes (.NET8 and MAUI8) so we could not do it without a week of additional labour to go into it...which we can not spent at the moment.

So lets hope MAUI8 is not so much beta anymore as v7 was

0 Kudos
dotMorten_esri
Esri Notable Contributor

Sorry there's no trick to support NET7.

I'm not going to promise you MAUI is now perfect but definitely has been greatly improved. It's another reason we weren't too worried about moving quickly to .NET 8, because we knew the benefit of moving to .NET 8 will be big enough that we expect most of our .NET MAUI users to move fairly quickly.

Only breaking changes I personally know of were actually bug fixes, and people seemed to rely on wrong behavior, which naturally no longer works.

0 Kudos