Working With Location in Windows Phone: Listing 1
Creating the GeoCoordinateWatcher.
- By Nick Randolph
- 06/11/2012
private GeoCoordinateWatcher watcher;
public void StartTracking()
{
if (watcher == null)
{
watcher = new GeoCoordinateWatcher();
watcher.StatusChanged += LocationStatusChanged;
watcher.PositionChanged += LocationPositionChanged;
watcher.Start();
}
}
public void StopTracking()
{
if (watcher != null)
{
watcher.Stop();
watcher.StatusChanged -= LocationStatusChanged;
watcher.PositionChanged -= LocationPositionChanged;
watcher = null;
}
}
About the Author
Nick Randolph runs Built to Roam, a consulting company that specializes in training, mentoring and assisting other companies build mobile applications. With a heritage in rich client applications for both the desktop and a variety of mobile platforms, Nick currently presents, writes and educates on the Windows Phone platform.