In my Windows Phone 8 app, I am trying to use GetGeopositionAsync on the main page to display some items based on user location.
Calling GetGeopositionAsync does not
This is strange but GetGeoPositionAsync only returns the current position when the Geolocator is initialized with either MovementThreshold and/or ReportInterval.
Geolocator geolocator = new Geolocator();
geolocator.DesiredAccuracyInMeters = 50;
geolocator.MovementThreshold = 5;
geolocator.ReportInterval = 500;
Geoposition geoposition = null;
try
{
geoposition = await geolocator.GetGeopositionAsync(
maximumAge: TimeSpan.FromMinutes(5),
timeout: TimeSpan.FromSeconds(10));
}
catch (UnauthorizedAccessException ex)
{
// location services disabled or other error
// user should setup his location
}