GPS Emulator for Windows Phone 7

by Joey deVilla on January 30, 2011

GPS Emulator: Photo of a globe

GPS drives a lot a mobile applications, and we’re only just beginning to work out all the possible uses for it. On Windows Phone, you access location information with classes and interfaces provided in the System.Device.Location namespace. Here’s a quick look at its classes:

Class Description
CivicAddress

Represents a civic address. A civic address can include fields such as street address, postal code, state/province, and country or region.

CivicAddressResolver

Provides functionality for resolving a coordinate-based location to a civic address.

GeoCoordinate Represents a geographical location that is determined by latitude and longitude coordinates. May also include altitude, accuracy, speed, and course information.
GeoCoordinateWatcher

Supplies location data that is based on latitude and longitude coordinates.

GeoPosition(Of T)

Contains location data of a type specified by the type parameter of the GeoPosition(Of T) class.
GeoPositionChangedEventArgs(Of T)

Provides data for the PositionChanged event.

GeoPositionStatusChangedEventArgs Contains data for a GeoPositionStatusChanged event.
ResolveAddressCompletedEventArgs Provides data for the ResolveAddressCompleted event.

Writing location-aware apps is pretty simple using GeoCoordinateWatcher, but until now, testing them has been a bit of a chore. There wasn’t a straightforward way to test GPS apps in the emulator; you had to use a phone and actually go to real locations. While you really should do real-world testing of GPS apps by actually going out into the real world, it would be easier (especially in the beginning) if there were some way to test GPS apps in the emulator.

Enter the Windows Phone GPS Emulator! Here’s what Yochay Kiriaty has to say about it in the Windows Phone Developer Blog:

The Windows Phone GPS Emulator (a small WPF application) and one WP7 DLL enable you to debug your application on the Windows Phone emulator or a real device without leaving the comfort of your home or office. Once you’ve completed your testing and debugging, you only need to change a single line of code to switch to the device back to real GPS.

With the GPS Emulator, you can set a location anywhere on the globe by using the map display. Furthermore, you can plan routes with multiple intermediate waypoints, or use Bing services to calculate driving directions between locations. Once you’ve planned a route, you can simulate driving through the pre-defined waypoints along the path.

The recipe includes:

  • The Windows GPS Emulator application
  • The Windows Phone GPS Emulator Client DLL
  • A simple Windows Phone Test client
  • A complete end-to-end Windows Phone App using Bings maps (a more complex sample)

Using the GPS Emulator lets you create complex path that you can playback just as if you were driving or walking. Then, you can choose your Windows Phone application and receive the location information form the GPS Emulator just as if you got it via the real GPS.

Here’s a screenshot of the GPS Emulator and Windows Phone Emulator in action:

Screenshot of the GPS Emulator and the Windows Phone 7 Emulator, side by side

Want to get started with the GPS Emulator? Head on down to the GPS Emulator page in App Hub and download the recipe, which includes:

  • The Windows GPS Emulator application
  • The Windows Phone GPS Emulator Client DLL
  • A simple Windows Phone Test client
  • An end-to-end Windows Phone App using Bing maps (a more complex sample)

This article also appears in Canadian Developer Connection.

Leave a Comment

Previous post:

Next post: