Skip to content

Instantly share code, notes, and snippets.

@maskaravivek
Created April 17, 2014 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maskaravivek/10986631 to your computer and use it in GitHub Desktop.
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
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