Share via


Create location aware apps using geolocation and Bing Maps

Ross Heise has a quick walkthrough on adding geolocation to your Windows store Apps. Here’s a bit of code to whet your appetite:

The Windows.Devices.Geolocation namespace is used for retrieving your location. Whether you use GPS, a WiFi network, or an IP address to retrieve a user’s location depends on two primary factors:

  1. The accuracy level requested. This is the ideal level of accuracy to meet your app’s needs.
  2. The availability of location data.  Meaning, not all devices have GPS built in.   Or a network or Wi-Fi connection may not be available when the location is requested.

C#

 Geolocator geolocator = new Geolocator();
 geolocator.DesiredAccuracy = Windows.Devices.Geolocation.PositionAccuracy.High;
 Geoposition pos = await geolocator.GetGeopositionAsync().AsTask(token);

JavaScript

 var geolocator = Windows.Devices.Geolocation.Geolocator();
 geolocator.desiredAccuracy =
 Windows.Devices.Geolocation.PositionAccuracy.high;
  
 // Get the geoposition, capturing the request in a 'promise' object.
 var promise = geolocator.getGeopositionAsync();

[…] For full details on using geolocation and the Bing Maps SDK, we have a new video, how-to topic , and code sample that leads you through the steps of asynchronously acquiring your location and then using the Bing Maps SDK to show where you are in a visual manner.

Create location aware apps using geolocation and Bing Maps

Technorati Tags: Windows,Windows 8,geolocation,Windows programming,Windows SDK,Windows Store app,Bing Maps