Created
April 17, 2014 19:14
-
-
Save staticfloat/11005663 to your computer and use it in GitHub Desktop.
Mapping from GPS PositionStatus's to strings
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
// 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