Windows Phone 8.1 XAML中的MapRouteFinder.GetDrivingRouteAsync和MapServiceToken [英] MapRouteFinder.GetDrivingRouteAsync and MapServiceToken in Windows Phone 8.1 XAML

查看:75
本文介绍了Windows Phone 8.1 XAML中的MapRouteFinder.GetDrivingRouteAsync和MapServiceToken的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Windows Phone 8.1 XAML应用程序,该应用程序使用MapControl来显示地图.在MapControls Loaded事件中,我设置了有效的Bing API密钥

I have a Windows Phone 8.1 XAML app that uses the MapControl to display maps. In the MapControls Loaded event, I set a valid Bing API key

void MyMap_Loaded(object sender, RoutedEventArgs e)
{
    MyMap.MapServiceToken = the key
    MapService.ServiceToken = the key
}

我知道Bing API密钥是有效的,因为未显示MapControl中的水印.

I know the Bing API key is valid because the watermark in the MapControl is not shown.

从带有MapControl的页面导航到另一个页面,在该页面中,我尝试在ViewModel中查找行驶路线:

From the page with the MapControl I navigate to another Page where in the ViewModel I try to find a driving route:

var driving = await MapRouteFinder.GetDrivingRouteAsync(new Geopoint(new BasicGeoposition
{
    Latitude = Latitude,
    Longitude = Longitude
}), Detail.GeneralInfo.GpsCoordinates.Position, MapRouteOptimization.Time);

问题是driving.Status始终是InvaldiCredentials.

有什么我想念的吗?

文档说

Note that you have to provide the authentication token in two separate properties in an app that uses both Map services and the Map control.

而我做到了.

我使用的Bing API密钥是为Basic/Public Windows Phone App生成的.我还尝试为Basic/Public Windows App生成一个,没有变化.

The Bing API key I use is generated for Basic / Public Windows Phone App. I also tried to generate one for Basic / Public Windows App, no change.

推荐答案

我有一个使用此令牌的有效应用程序.我只将其设置为XAML中的Map控件,然后可以同时使用Map和MapService.

I have a working app that uses this token. I only set it to a Map control in XAML, and then I can use both the Map and the MapService, apparently.

我的地图"密钥令牌的长度为22个字符.获得它的唯一方法是AFAIK

My Maps key token is 22 characters long. The only way to get it is, AFAIK

  • 制作应用
  • 将其上传到商店但不提交
  • 您的应用与商店ID相关联,您将看到地图令牌
  • 这是您需要的令牌
  • Make an app
  • Upload it to the store but do not submit
  • You app gets associated with a store ID and you will see a map token
  • THAT is the token you will need

查看屏幕截图.是您遵循的程序吗?

See screenshot. Is that the procedure you followed?

还要确保xmlns:Maps ="using:Windows.UI.Xaml.Controls.Maps",而不是旧的Bing控件.甚至不知道旧控件在Universal Apps btw中是否仍然可用

Also, make sure xmlns:Maps="using:Windows.UI.Xaml.Controls.Maps", not the old Bing control. Don't even know if the old control is still available in the Universal Apps btw

这篇关于Windows Phone 8.1 XAML中的MapRouteFinder.GetDrivingRouteAsync和MapServiceToken的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆