maui
maui copied to clipboard
Cant add Pin to Microsoft.Maui.Controls.Maps Pin collection after page is loaded using Android app
Description
I am using the new Map control {Microsoft.Maui.Controls.Maps}. I specify a pin collection using ItemSource. When I add a pin to the Pin collection in the code behind, I get the following exception:
System.MissingMethodException Message=Method not found: bool Microsoft.Maui.Devices.Sensors.Location.op_Inequality(Microsoft.Maui.Devices.Sensors.Location,Microsoft.Maui.Devices.Sensors.Location)
I am aware this is a new control under development so I wont go into other issues like none of the Pins defined at page initialization appearing.
MauiMapTest.zip
Steps to Reproduce
- Edit the Android AndroidManifest.xml "com.google.android.geo.API_KEY" line with a valid key in the included MauiMapTest app
- Compile and run the app on an android device
- Tap the "ADD" button (Should have labeled it BOOM)
- The app will stop with the System.MissingMethodException
Link to public reproduction project repository
https://github.com/dotnet/maui/files/9602439/MauiMapTest.zip
Version with bug
6.0.486 (current)
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android 12.1 - API 32
Did you find any workaround?
No
Relevant log output
No response
The problem I described above is corrected by compiling the app for Net 7. Look at https://github.com/dotnet/maui-samples/tree/main/7.0/UserInterface/Views/Map/MauiMaps to see a working version of Map control use.
The map control is only available in .NET 7