maui icon indicating copy to clipboard operation
maui copied to clipboard

Cant add Pin to Microsoft.Maui.Controls.Maps Pin collection after page is loaded using Android app

Open davefxy opened this issue 3 years ago • 1 comments

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

  1. Edit the Android AndroidManifest.xml "com.google.android.geo.API_KEY" line with a valid key in the included MauiMapTest app
  2. Compile and run the app on an android device
  3. Tap the "ADD" button (Should have labeled it BOOM)
  4. 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

davefxy avatar Sep 19 '22 21:09 davefxy

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.

davefxy avatar Sep 20 '22 20:09 davefxy

The map control is only available in .NET 7

PureWeen avatar Sep 22 '22 18:09 PureWeen