Created
November 18, 2013 17:03
-
-
Save bruinbrown/7531377 to your computer and use it in GitHub Desktop.
Hack to get around broken Geolocator.GetPositionAsync on WP8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void GetLocation() | |
{ | |
var locator = new Geolocator(); | |
Geoposition position = null; | |
try | |
{ | |
var positionTask = locator.GetGeopositionAsync(); | |
await Task.Delay(200); | |
positionTask.Cancel(); | |
} | |
catch (TaskCanceledException ex) | |
{ | |
} | |
position = await locator.GetGeopositionAsync(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment