Several Things To Know When Developing Location-Aware Metro Style Apps

By Miao Wei, Published: 06/29/2012, Last Updated: 06/28/2012

You can use the Window Runtime Geolocation API in developing location-aware Metro Style apps, for example, attaching geo-location information to photos, searching for local Points of Interests, plotting the hiking routes in an outdoors fitness app etc. This blog describes some aspects we found out while using the WinRT Geolocation API.

Location Providers

When using the WinRT Geolocation API to get location information, you can not explicitly specify a specific “location provider” you want to receive the data from. Location data received from WinRT may come from Windows Location Provider, which utilizes WiFI triangulation or IP addresses to determine the device’s current location. The location data may also come from other sources, for example, the GPS. In other words, the Window.Devices.Geolocation API determines the “best” location data to provide to the application.

Accuracy of Location Data

The application can use the Geolocator.DesiredAccuracy property to control the data accuracy level it expects the Geolocation API to provide. The Geolocator.DesiredAccuracy property’s value can be either “Default” or “High”. The app should only request “High” accuracy location data when it is necessary. Why? In general it consumes more battery power and network bandwidth to achieve higher data accuracy. Some high accuracy location services may also involve monetary charges by the wireless network operators.
When receiving the location data from WinRT, the app can check the “Accuracy” property of the Geocoordinate object to determine if the accuracy (in meters) fits the app’s needs.

The following JavaScript code snippet serves as an example:

function onPositionChanged(args) {
var pos = args.position;

if (pos.coordinate.accuracy > 35.0) {
//handle higher accuracy data
else {
//handle lower accuracy data


One-time Location Requests and Responding to Location Updates

The Geolocator class provides two ways to retrieve the user’s current location: by calling the getGeopositionAsync method, or by adding an event listener to monitor the “positionchanged” event. You should use the receiving location updates method only when the app needs to frequently check the location changes. In many cases, such as attaching the geolocation to a photo or document, finding the local restaurants, using the one-time location request can fulfill the app’s needs.

Location Start-up Time Consideration

So far we did not see the WinRT Geolocation API provides a method to return the device’s “last known position”. Some location detection methods such as GPS require a relatively long startup time. In some use cases we may use the cached last known position to speed up the process. For example, if the user is searching for the local POIs, the application can kick off the search using the cached “last known position” before it receives the actual location fix. Once the actual location fix is received, the application compares the cached last known position with it. If the cached last known position falls in a permissible range with the actual fix, the application will use the search results returned from the search job which has already been started.

Frequency of Location Updates
To achieve the best user experience and system performance, your app should adjust the frequency it receives the location updates from the WinRT Geolocation API. The Geolocator class provides two properties to adjust the location update frequency: one is the time-based “ReportInterval” property; the other is the space-based “MovementThreshold” property. How to tune these two properties mainly depends on the characteristics of the app: a car navigation app may receive a lot more frequent updates than an outdoors walking fitness app.

Product and Performance Information


Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804