Over a million developers have joined DZone.

Windows Phone testing for sensors

· Mobile Zone

If you are planning on using the new sensors that are in the Windows Phone code named Mango (Gyroscope, Compass, etc…), you need to add some code to your application to test and see if they are available.  You can use the Microsoft.Devices.Sensors namespace to find this out.

bool IsGyroSupported = Microsoft.Devices.Sensors.Gyroscope.IsSupported;

bool IsAccelerometerSupported = Microsoft.Devices.Sensors.Accelerometer.IsSupported;

bool IsCompassSupported = Microsoft.Devices.Sensors.Compass.IsSupported;

bool IsMotionSupported = Microsoft.Devices.Sensors.Motion.IsSupported; 

The Motion Sensor is the API that combines all the other sensors and adds some math to make it easier to build your application using sensors

Source: http://thesociablegeek.com/2011/10/13/windows-phone-testing-for-sensors/

Topics:

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}