如何获取 Bing Maps SessionId for non-billable Bing Rest service using the WinRT API

How to acquire Bing Maps SessionId for non-billable Bing Rest service using the WinRT API

我了解在 Bing 中使用 SessionId Maps Rest 服务调用在每个客户端的第一次查询后不计费,这很好。遗憾的是,在WinRT/StoreApp环境下如何获取这个SessinID还不是很清楚。 MSDN 站点上的示例在 C# 中显示了以下代码以获取此 ID:

Map.CredentialsProvider.GetCredentials((c) =>
{
    string sessionKey = c.ApplicationId;

    //Generate a request URL for the Bing Maps REST services.
    //Use the session key in the request as the Bing Maps key
});

我目前遇到的唯一问题是 Map class 及其实例都没有此 CredentialsProvider 功能方法。我只能从 Map 实例中得到 Bing Map keys using its Credentials 属性,其中 returns 添加到 Map 实例的 XAML 声明中的字符串.

如果有人可以阐明如何使用 Bing 地图 Windows 商店 API 获取相关的 SessionID,那就太好了!我什至不确定我是否需要在我的代码中生成它,或者它是由平台本身生成的...谢谢!

找到解决方法:初始化后在Map实例上调用GetSessionIDAsync!