GPS systems are going to be popular these days as many people need them on their phones, especially tourists. But, many developers do not know how to get the starting point to do GPS systems.

This is an example of a GPS system on Windows Phone 7 (the new technology from Microsoft). It shows how to get your position using the built-in locator in the phone. And then show this location on Bing Maps (like Google Maps but the Microsoft version).

Background

To work with Bing Maps, you have to get a Bing Key as a developer. It is a unique key for your application so that it is able to log in to the Bing Maps.

You can get this key from Bing Maps Portal when you register a Windows Live account.

Once you get the key, you can attach it to your application and get the maps you wish. After that, we are using an important service in the application - the Terra Service which can get the location as a text depending on latitudes and longitudes. You can add a service by Right-Clicking on the project name and choose Add Service Reference. For the Terra service, you can use this URL - http://msrmaps.com/TerraService2.asmx, and then add it to the usings with the name you named it while importing.

In the constructor, we create an event handler for the ConvertLonLatPtToNearestPlaceCompleted event and this is raised when the service gets the nearest location of our coordinates, and then makes the zoom buttons visible in the map.

GeoCoordinateWatcher class is a built-in class in the phone locator which we use to get the current coordinates using the Position property.

I added some default coordinates because in the Windows Phone Emulator, there is no locator unit so it will not get the coordinates correctly. I added these defaults for test only. At the end, we use the Terra service object to search for the name of this location.

Points of Interest

In my work, I added a few buttons to change the map mode between Aerial, road, street, satellite, ...... etc., but I found that it is unnecessary so I removed it to make a space on the screen.

History

This is the first version, and I will come up with more advanced features soon.