Location for Windows Phone 8
May 03, 2013
Applies to: Windows Phone 8 only
With Windows Phone 8, you can create applications that utilize the phone’s physical location. Scenarios for location-aware applications include checking the user into a web service using the user’s instantaneous location and tracking the user’s location as it changes over a period of time. The location data the phone provides comes from multiple sources including GPS, Wi-Fi, and cellular. There are two different sets of APIs that can be used to incorporate location data into your application. This topic will help you decide which location API is right for your application.
The Windows Phone Runtime location API is new in Windows Phone 8. It has the following features:
Accessible from managed and native code. If you are writing a Direct3D app application, you must use this API for location. If you are creating a managed app, it is recommended that you use this API as well.
Greater support for one-shot location acquisition. The API allows the app to specify the desired accuracy of the location result as well as the maximum time desired for acquiring the result in order to balance accuracy and responsiveness. It is recommended that applications use one-shot location when tracking isn’t required. This results in better battery life and, therefore, a better user experience.
When tracking location, apps can request to receive location updates after a specified time interval or after the device has moved at least a specified distance from the previous location.
Convergent with Windows 8. Although there are minor differences between the two platforms, this API will allow you to reuse most of your location code if you are targeting both the phone and the desktop.
For information on using the Windows Phone Runtime location API in your application, see the following topics.
To download a sample app that demonstrates getting the phone’s current location, tracking the phone’s location, and tracking location in the background, see Location Sample for Windows Phone 8.
The .NET location API was introduced in Windows Phone, but is fully supported on Windows Phone 8. It is recommended that you use this API if you are targeting both Windows Phone OS 7.1 and Windows Phone 8 devices and you want to reuse code between the applications. Otherwise, it is recommended that you use the new Windows Phone Runtime interface. For more information on developing apps using the .NET location API, see .NET Location API for Windows Phone 8.