How to test apps that use the accelerometer for Windows Phone 8

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

The Windows Phone SDK includes an accelerometer sensor simulator. This topic describes how to test apps that use the accelerometer.

You can find code samples that use the accelerometer at Samples gallery on Windows Phone Dev Center.

This topic contains the following sections.

Viewing the accelerometer sensor simulator

You can view the accelerometer sensor simulator from Windows Phone Emulator.

To view the accelerometer sensor simulator

  1. In Visual Studio, run the app you want to test in the emulator.

  2. At the bottom of the emulator toolbar, click the chevron button to open the Additional Tools window.

  3. Click the Accelerometer tab to view the accelerometer sensor simulator.

    The following image shows the accelerometer sensor simulator.

Testing apps with the accelerometer sensor simulator

You can test the accelerometer sensor with live input or pre-recorded input.

The only type of recorded data that’s available simulates shaking the phone. You can’t record or save your own simulations for the accelerometer.

To test an app with live input

  1. In Visual Studio, run the app you want to test in the emulator.

  2. Open the Additional Tools window.

  3. Set the Orientation drop-down list to the desired starting orientation for the simulator.

  4. In the middle of the simulator, drag the colored dot to simulate movement of the device in a 3D plane.

    Moving the dot on the horizontal access rotates the simulator from side to side. Moving the dot on the vertical access rotates the simulator back and forth, rotating around the x-axis.

    As you drag the dot, the X, Y, and Z coordinates update based on the rotation calculations.

    You cannot move the dot outside the bounding circle in the touch pad area.

  5. Optionally, click Reset to restore the simulator to the starting orientation.

To test an app with recorded input

  1. In Visual Studio, run the app you want to test in the emulator.

  2. Open the Additional Tools window.

  3. Set the Orientation drop-down list to the desired starting orientation for the simulator.

  4. In the Recorded Data section, click the Play button to start playback of the simulated data.

    The only option available in the Recorded Data list is shake.

Note

The simulator does not move when it plays back the data.

See Also

Reference

Accelerometer

Other Resources

How to get data from the accelerometer sensor for Windows Phone 8