How to: Test Applications that Use the Accelerometer
March 22, 2012
The Windows Phone SDK 7.1 includes an accelerometer sensor simulator. This topic describes how to test applications that use the accelerometer. You can find accelerometer samples at Code Samples for Windows Phone.
You can easily view the accelerometer sensor simulator from the emulator.
To view the accelerometer sensor simulator
-
Move the mouse pointer to the right of the emulator to display the emulator toolbar.
The following image shows the toolbar with the chevron button highlighted.
-
At the bottom of the emulator toolbar, click the chevron button to open the Additional Tools window.
-
Click the Accelerometer tab to view the accelerometer sensor simulator.
The following image shows the accelerometer sensor simulator.
You can test the accelerometer sensor with live input or pre-recorded input.
To test an application with live input
-
In Visual Studio, run the application you want to test in the emulator.
-
Open the Additional Tools window.
-
Set the Orientation drop-down list to the desired starting orientation for the simulator.
-
In the middle of the touch pad, drag the pink colored dot to simulate movement of a 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. You cannot move the dot outside the bounding circle in the touch pad area. As you drag the dot, the X, Y, and Z coordinates update based on the rotation calculations.
To test an application with recorded shake input
-
Set the Orientation drop-down list to the desired starting orientation for the simulator.
-
Ensure the Recorded Data drop-down is set to Shake
-
In Visual Studio, run the application to be tested in the emulator.
-
When the application has loaded in the emulator, click the Play button in the Recorded Data section to start playback of the simulated data.
Note:
The simulator will not move when it plays back the data.