Getting to know your windows phone’s GPS.

Reading time icon 6 min. read


Readers help support MSpoweruser. We may get a commission if you buy through our links. Tooltip Icon

Read our disclosure page to find out how can you help MSPoweruser sustain the editorial team Read more

In this short article I want to give a brief introduction at how location services work on windows phone. As is quite obvious from the name, location service is the build-in service that provides location data to windows phone OS, build-in and third party apps. Curious why this service is named location service and not GPS service? There is a reason for that. Even though each windows phone out there is equipped with a GPS module, location information does not always come from a GPS. In fact, most of the time windows phone will attempt to use other sources first, before spending extra power to power on the real GPS module.

Here are three sources of information windows phone is using to obtain location info: cellular radio, Wi-Fi radio and the gps module. These three sources combined are often referred to as AGPS, which stands for Assisted GPS. In this list GPS module actually comes last and is used last too. It takes quite a lot of power to get gps signals from the satellites. It also takes a long time to get fix on the minimum 3-4 satellites needed to perform a triangulation and get the actual location. It doesn’t work indoors and can be seriously affected by outdoors weather conditions, tree cover and nearby mountains or tall structures. When GPS works it gives you the most precise data, but every so often it does not. It might simply be impossible to get correct GPS coordinates in your current location.

Here where other two sources come into play. When not in airplane mode and within the range, cell phone is always connected to one or more cell towers. Knowing locations of cell towers near you allows windows phone to get a very approximate location. The error margins are huge, but getting this information is fast, requires almost no additional power, works almost everywhere and can be good enough for many applications.

Next method is extremely effective in urban areas and is based on Wi-Fi radio. You don’t have to be connected to any Wi-Fi network, but you have to leave Wi-Fi radio On. The phone will start sniffing around for known signatures of Wi-Fi networks. On the server side Microsoft stores signatures of millions of Wi-Fi networks and their locations. In most cases Wi-Fi networks from people’s homes do not move much and in populated areas your phone will see a lot of Wi-Fi networks around every corner. As long as database is reasonably often updated this can give the phone a surprisingly high accuracy location information very fast, just by looking at Wi-Fi networks around you. As I already mentioned – you don’t even need to connect. However, as the database of networks location is only available through internet your phone will either need to use the data plan or a known Wi-Fi network connection to get the data.

Tip: if you use location often in populated places – always leave Wi-Fi radio on, even if you don’t plan to connect to any networks. It will potentially save power and allow your phone to get location much faster in such areas.

One question I have seen asked quite frequently is why there seems to be no apps for windows phone to show current positions of satellites and other such useful GPS info, frequently found on GPS navigation devices. The reason is obviously because Microsoft does not expose any API to developers to see such low level information. More than that, in most cases location comes to windows phone without using GPS at all.

Tip: Since windows phone is so much optimized to get the initial location information as fast as possible, the first reading you get will often be least accurate. Most apps, including build-in apps like Maps actually subscribe to changes in location, so if you give it some time – the accuracy of your location will likely improve.

One setting exposed to developers is called “Require High Accuracy”. Actually this setting has no direct effect on accuracy at all. But when apps are using it, location service will try to use more power and correct the coordinate information using GPS receiver, even if information from less power-hungry sources (like cellular radio or Wi-Fi) is also available.

Using current implementation of location service it is not for users or developers possible to definitely tell if location comes from GPS or other less accurate sources. One good giveaway though is elevation. Elevation is always 0 when location information comes from cell towers or Wi-Fi networks. Also reported accuracy is much higher for GPS.

But even though accuracy itself is high, due to small size of GPS antennas in mobile phones, data comes with a lot of random noise. Even in good conditions outside GPS location can be quite a few feet off. This might not be a big problem if you only need to know one location (after all we do not expect location data to be precise), but becomes a huge problem when you try to use build-in GPS to record a track or get an elevation profile and get an extremely noisy picture. Clever apps, such as GPS Calculator and recently released GPS Calculator PRO implement an advanced algorithm called Kalman filter to smooth out this data and remove the noise.

Tip: To save power or for privacy reasons you can always turn off location services system-wide by setting Settings->system->location: Location services to Off. In addition to this master switch Windows Phone also gives you more granular control about location services use via Settings->applications. Check out individual location settings for Internet Explorer, maps, pictures+camera and search. For example setting “Include location info in pictures you take” to On will make sure that windows phone will automatically geo-tag your photos when location information is available.

About kitya:

Kitya is a GPS enthusiast and the hobbyist windows phone developer too. He is actively developing several free windows phone apps that help users work with location services, such as GPS Calculator, Image Map and Weather Stats, and now also GPS Calculator PRO and Image Map Plus.

More about the topics: coordinates, gps, Location, location services