Skip to content

Instantly share code, notes, and snippets.

@staticfloat
Created April 17, 2014 19:14
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 staticfloat/11005663 to your computer and use it in GitHub Desktop.
Save staticfloat/11005663 to your computer and use it in GitHub Desktop.
Mapping from GPS PositionStatus's to strings
// Helper function to get status string for location
string getStatusString(PositionStatus locStatus)
{
switch (locStatus)
{
case Windows.Devices.Geolocation.PositionStatus.Ready:
// Location data is available
return "Location is available.";
case Windows.Devices.Geolocation.PositionStatus.Initializing:
// This status indicates that a GPS is still acquiring a fix
return "A GPS device is still initializing.";
case Windows.Devices.Geolocation.PositionStatus.NoData:
// No location data is currently available
return "Data from location services is currently unavailable.";
case Windows.Devices.Geolocation.PositionStatus.Disabled:
// The app doesn't have permission to access location,
// either because location has been turned off.
return "Your location is currently turned off. " +
"Change your settings through the Settings charm " +
" to turn it back on.";
case Windows.Devices.Geolocation.PositionStatus.NotInitialized:
// This status indicates that the app has not yet requested
// location data by calling GetGeolocationAsync() or
// registering an event handler for the positionChanged event.
return "Location status is not initialized because " +
"the app has not requested location data.";
case Windows.Devices.Geolocation.PositionStatus.NotAvailable:
// Location is not available on this version of Windows
return "You do not have the required location services present on your system.";
default:
return "Unknown status";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment