2
\$\begingroup\$

I want to do a little game that uses the Windows Phone inclinometer to control an object's pitch, roll and yaw. In addition, I need the accelerometer in another project to let an object jump.

Can I use the inclinometer and accelerometer on every Windows Phone device or are there older devices that don't support the inclinometer and accelerometer? Can I use the inclinometer and accelerometer on Windows Tablets like the surface?

\$\endgroup\$
1
\$\begingroup\$

The short answer is no.

The longer answer is that you can (and should) specify the hardware requirements of your application via your application's manifest. You should read the section on MSDN explaining this as well as the available sensor capabilities you can expose. Essentially, you add the appropriate keys from that page to the <Capabilities> element of your manifest file:

<Capabilities>
  <Capability Name="ID_REQ_GYROSCOPE"/>
</Capabilities>

This will allow you to avoid problems when users don't have the required hardware, without having to worry yourself about which specific hardware supports which sensors (especially since that information will certainly change over time).

The battery of sensors available in the Windows Phone API are detailed in the documentation. Currently:

  • The accelerometer should always be available.
  • The gyroscope and compass sensors are not required and may not be present on a given device (it appears they will never be present in WP7 devices).

Further, you can see here that the inclinometer readings are actually derived from other hardware sensors:

The Inclinometer sensor specifies the yaw, pitch, and roll values of a device and work best with apps that care about how the device is situated in space. Pitch and roll are derived by taking the accelerometer’s gravity vector and by integrating the data from the gyrometer. Yaw is established from magnetometer and gyrometer (similar to compass heading) data.

The magnetometer and gyroscope are optional features, again, which you can specify the need for via your manifest as above.

The Surface should have an accelerometer, gyroscope and compass (as should the successor). The Windows API has a parallel namespace for sensor access.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.