Created
April 17, 2014 14:13
-
-
Save maskaravivek/10986631 to your computer and use it in GitHub Desktop.
How to check whether location is enabled on windows phone device? http://wtuts.me/LocationEnabled
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
public void locationfinder() | |
{ | |
Deployment.Current.Dispatcher.BeginInvoke(() => | |
{ | |
GeoCoordinateWatcher g = new GeoCoordinateWatcher(GeoPositionAccuracy.High); | |
g.Start(); | |
if (g.Permission == GeoPositionPermission.Denied) | |
{ | |
App.phonelocationenabled = false; | |
// then we know it is off, else we assume it is on | |
// Show message box.. | |
} | |
else | |
{ | |
App.phonelocationenabled = true; | |
} | |
g.Stop(); | |
g.Dispose(); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment