This article will explain how to obtain the ApplicationId and AuthenticationToken and then apply them for the Map Control in the Windows Phone Application.
When a Map Control is included in your Windows Phone App, it is necessary to add the API key (ApplicationId and AuthenticationToken) to the Map Control for the app to run fine in the production. Note that you don’t need the API key during the development of the application.
How to Obtain & apply ApplicationId and AuthenticationToken for Map Control in WP8?
The ApplicationId and the AuthenticationToken for WP8 App is obtained during the Windows Phone Marketplace submission. Follow the below steps to retrieve the API key
1. Login to the Windows Phone Dev Account with your developer account credentials
2. Navigate to the Dashboard and create / edit the existing app submission.
3. In the Application Info screen, click “Map Services” as shown in the below screenshot.
4. In the Map services screen, click “Get token” hyperlink.
5. This will generate the Map service ApplicationId and Map service AuthenticationToken and display in the same screen. Copy them.
6. Open your Windows Phone Application and the page where the Map Control is included. Include the API Key in the map control’s loaded event as shown in the below.
private void Map1_Loaded(object sender, RoutedEventArgs e) { MapsSettings.ApplicationContext.ApplicationId = "Paste ApplicationId"; MapsSettings.ApplicationContext.AuthenticationToken = "Application Token"; }
<maps:Map x:Name="Map1" HorizontalAlignment="Left" Height="424" Margin="0,44,0,0" VerticalAlignment="Top" Width="446" Loaded="Map1_Loaded" />
7. Rebuild your app with the release mode and submit the XAP file.
1 Comment
How to get it working with a developer device or as a betatester? Tha map is just blank on a physical device, but on the emulator its ok.