Reputation: 2078
I am developing a Windows 8 Store app in xaml and it uses user's GPS location.IS there any way I can know programmatically if the device user is using has GPS capability ?
Unlike Windows phone it only works when there is internet connection ?
Upvotes: 2
Views: 2630
Reputation: 454
You should be able to check the sensor state.
NotSupported
The sensor hardware is unavailable.
Ready
The sensor is available and resolving data.
Initializing
The sensor is available and initializing.
NoData
The sensor is unable to obtain data.
NoPermissions
The caller does not have permission to access the
sensor’s data.
Disabled
The sensor is disabled.
Upvotes: 0
Reputation: 8852
You need to check the status of the location sensor
var location = new Geolocator();
if(location.LocationStatus == PositionStatus.NotAvailable)
{
//Do Something
}
else
{
//Do Something else
}
Following article covers Geolocation
topic really nicely
http://www.jeffblankenburg.com/2012/11/14/31-days-of-windows-8-day-14-geolocation/
Upvotes: 2