Chapter 12. Where Am I? Finding Your Way


  • Determining the current location

  • Simulating location in the Windows Phone emulator

  • Working with the Bing Maps control

Over the last couple of years more and more devices have a built-in GPS device. Unfortunately, this typically doesn't work well when you are located in an office or inside shopping. In these scenarios the GPS either takes a long period to resolve a signal or is blocked by the surrounding buildings. Luckily, in these cases, triangulation, based on available Wi-Fi networks or cellphone towers, will give a good approximation to your location.

In this chapter, you will learn how to connect to and work with the Windows Phone Location Service, which hides the complexities of communicating with GPS devices and deciding when to perform Wi-Fi or cellular tower–based triangulation behind an easy-to-use interface. This can be used not only to retrieve the user's current location, but also to detect when they are on the move. You will also see how easily you can integrate a map into your application in order to display geographically based data.


In order to protect the user's privacy, Windows Phone takes a consent-based approach to location. This means that in order for an application to access location information, the user will have to actively agree to the application's request. The first time the application attempts to access location information, it must display a prompt requesting that the user consent ...

Get Professional Windows® Phone 7 Application Development: Building Applications and Games Using Visual Studio, Silverlight®, and XNA® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.