Collapse the table of content
Expand the table of content

Microsoft.Devices.Sensors Namespace

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

This namespace provides APIs to access the accelerometer and other sensors on the phone.


If you use this API in your app, you must specify the following capabilities in the app manifest. Otherwise, your app might not work correctly or it might exit unexpectedly.


Windows Phone 8, Windows Phone OS 7.1

For more info, see App capabilities and hardware requirements for Windows Phone 8.

Public classAccelerometerProvides Windows Phone applications access to the device’s accelerometer sensor.
Public classAccelerometerFailedExceptionThe exception that may be thrown during a call to Start() or Stop(). The Message field describes the reason for the exception and the ErrorId field contains the error code from the underlying native code implementation of the accelerometer framework.
Public classAccelerometerReadingEventArgsProvides data for ReadingChanged events.
Public classCalibrationEventArgsProvides data for Calibrate and events.
Public classCompassProvides Windows Phone applications access to the device’s compass sensor.
Public classGyroscopeProvides Windows Phone applications access to the device’s gyroscope sensor.
Public classMotionProvides Windows Phone applications information about the device’s orientation and motion.
Public classSensorBase<TSensorReading>The base class for all Windows Phone sensor classes.
Public classSensorFailedExceptionRepresents the exception that is thrown when a sensor operation fails.
Public classSensorReadingEventArgs<T>Provides data for CurrentValueChanged events.

Public structureAccelerometerReadingContains the acceleration and timestamp for an accelerometer reading, indicating the magnitude and direction of forces applied to the device.
Public structureAttitudeReadingContains information about the orientation of the device in space.
Public structureCompassReadingContains information about the magnetic field detected by the device’s compass sensor, which can be used to determine the orientation of the device relative to the Earth’s magnetic field.
Public structureGyroscopeReadingContains information about the rotation acceleration of the device.
Public structureMotionReadingContains information about the orientation and movement of the device.

Public interfaceISensorReadingThe interface that is implemented by all sensor reading classes.

Public enumerationSensorStateAn enumeration of values for expressing the current state of the accelerometer. The state of a sensor can be obtained using its State property.

© 2017 Microsoft