xamarin / Essentials

Xamarin.Essentials is no longer supported. Migrate your apps to .NET MAUI, which includes Maui.Essentials.
https://aka.ms/xamarin-upgrade
Other
1.52k stars 505 forks source link

Maps dont show the name #824

Closed TFreudi1 closed 5 years ago

TFreudi1 commented 5 years ago

Maps-Api don't show the Name in Android 6.0, Android 8.1, Android 9.0 maybe on more, it onl shows the coordinates.

I use this code: public async Task NavigateToBuilding25() { var location = new Location(47.645160, -122.1306032); var options = new MapLaunchOptions { Name = "Microsoft Building 25" };

    await Map.OpenAsync(location, options);
}

Xamarin Essentials 1.0.1 Screenshot_20190625-124510_Maps

TFreudi1 commented 5 years ago

Here is the complete project, very simple. MapsTest.zip

jamesmontemagno commented 5 years ago

Looks like Google has changed the API: https://developers.google.com/maps/documentation/urls/android-intents

Uri gmmIntentUri = Uri.parse("geo:37.7749,-122.4192?q=" + Uri.encode("1st & Pike, Seattle"));

This is the new API without the extra lat long, which i always thought was weird that they put it there.

jamesmontemagno commented 5 years ago

I can verify that their documented API doesn't work though :( it just does a search :( sad

jamesmontemagno commented 5 years ago

I just verified that our functionality works just fine in Here maps and other map apps.

jamesmontemagno commented 5 years ago

Validated that both work fine in here maps showing label and don't show label in Google Maps

geo:47.64516,-122.130603?q=47.64516,-122.130603(Microsoft%20Building%2025)
geo:0,0?q=47.64516,-122.130603(Microsoft%20Building%2025)

I confirmed that this used to work in a old version of Maps, so they must have broke it.

TFreudi1 commented 5 years ago

@jamesmontemagno Do you know how to start Heremaps with a intent and parameters ? I don't want to make it the default map app.

jamesmontemagno commented 5 years ago

I just installed here maps and the turned off the old default and launched it again and did one time on my pixel 2. They may have a special launcher uri, but they also accept the default Geo codes we use.

TFreudi1 commented 5 years ago

Thank for your offtopic answer. Yes I know, that also working for me, but I dont want the Here Map as the default. I thought maybe by chance he know it, I keep searching the net.

artbalbuena12 commented 4 years ago

Maybe a bit late to comment, but I was having this same issue and I found a workaround for this with Google Maps using Map URLs and its universal cross platform syntax: https://developers.google.com/maps/documentation/urls/guide#universal-cross-platform-syntax

This is my implementation in Xamarin.Forms: var mapsUri = $"https://www.google.com/maps/search/?api=1&query={locationName} {locationAddress}"; mapsUri = Uri.EscapeUriString(mapsUri); await Launcher.OpenAsync(new Uri(mapsUri));

This is also a workaround for #792.

TFreudi1 commented 4 years ago

This dont work for me because the location name is not really a name of a location. It is the location/name of a car, I tried to used it for small fleet management. Any other Map URL allows passing a name parameter to the pin, but we did'nt find it the google maps api's/urls.