0

I am having a strange problem with the use of MapLocationFinder.

I am using MapLocationFinder to retrieve longitude and latitude based on string address:

string address = ""; // Any address here

var locFinderResult = await MapLocationFinder.FindLocationsAsync(address, new Geopoint(new BasicGeoposition()));

After this, I use Laucher to start "drive to" application and get navigation map:

var geoPos = locFinderResult.Locations[0].Point.Position;

var url = $"ms-drive-to:?destination.latitude={geoPos.Latitude.ToString(CultureInfo.InvariantCulture)}&destination.longitude={geoPos.Longitude.ToString(CultureInfo.InvariantCulture)}&destination.name={address}";
var driveToUri = new Uri(url);

await Launcher.LaunchUriAsync(driveToUri);

Up until recently this worked just fine on all devices. I was not required any token or anything, since I am not implementing Map control in XAML. However, a couple days ago I started receiving "InvalidCredentials" response for locFinderResult. It still works on only one device. I have never used any credentials so I don't know why it only works on this one.

Does anyone knows what could cause this issue?

user2081328
  • 159
  • 3
  • 15

2 Answers2

1

It looks like from some recent time Microsoft requires you to get the key from the Bing Maps Developers Center to use this functionality. See, the instructions: https://learn.microsoft.com/en-us/windows/uwp/maps-and-location/authentication-key

Pavel
  • 910
  • 5
  • 6
  • Hmm, it seems so... But it still woks on one device for some reason, maybe I am still missing windows update there :). Anyway, this is a horrible decision made by Microsoft, to add more reasons why we should not use their platform. – user2081328 Jun 02 '17 at 12:38
  • I agree, my application was also broken in that way. It was very unpleasant when it was suddenly broken in production :( – Pavel Jun 02 '17 at 12:57
1

Go to https://www.bingmapsportal.com and create a key. Then add it to your app.

MapService.ServiceToken = "MyKey";
Heshan
  • 913
  • 8
  • 30