Reputation: 1666
How to detect if a sensor is available on a Windows 8 device? My app needs GPS to work properly, so I need a way to detect if it is available on the device it is running on.
Upvotes: 1
Views: 959
Reputation: 47
Here are some available sensors for Windows 8 devices.
you can check if they are available by GetDefault() method. It returns 'null' if the sensor is not available.
if(Accelerometer.GetDefault() != null)
{
// your code
}
if (Compass.GetDefault() != null)
{
// your code
}
if (Gyrometer.GetDefault() != null)
{
// your code
}
Upvotes: 1
Reputation: 12837
you can check the LocationStatus property of the Geolocator object... if it is NotAvailable or Disabled you are out of luck...
Upvotes: 0