Over a million developers have joined DZone.

Windows Phone testing for sensors

DZone 's Guide to

Windows Phone testing for sensors

· Mobile Zone ·
Free Resource

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/


Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}