Custom Accelerometer Motions For The Windows Phone Emulator
The new Windows Phone Mango SDK introduced a testing tool, that is tied to the device emulator, allowing developers to simulate location data and readings from the accelerometer sensor (now it also allows taking screenshots). This tool has a pre-set motion, called Shake
.
Image lost since transition to new blog
But that’s about it out-of-the-box. What would be great is having custom motions that can later on be tested multiple times with multiple applications. A lot of developers messing with the toolset don’t know that in fact, it is possible to add those multiple motions by simply building a custom XML file and placing it in Program Files\Microsoft XDE\1.0\sensordata\acc
.
I wrote a Windows Phone application that automatically captures data from the accelerometer sensor and stores it in the isolated storage.
Image lost since transition to new blog
When the capture is complete, the data can be pulled from the phone through the IsolatedStorageExplorer
tool, also available in the Mango toolset (located in Program Files\Microsoft SDKs\Windows Phone\v7.1\Tools\IsolatedStorageExplorerTool
). You can execute this command, if you are running the application in the emulator:
ISETool ts xd 87fbb02b-db71-4a52-bfcb-f7759f84a465 D:\Temporary
Where the GUID following xd
represents the application ID declared in the WMAppManifest.xml
file. The path at the end of the command is the destination where pulled data is placed.
If the application is located on a physical device (for better accelerometer readings and real-world testing), execute this command:
ISETool ts de 87fbb02b-db71-4a52-bfcb-f7759f84a465 D:\Temporary
Notice that instead of xd
there is now de
(device).
Once you pull the data from the Isolated Storage, you will see that the files you recorded are in the root of the IsolatedStorage
folder. You need to copy them to Program Files\Microsoft XDE\1.0\sensordata\acc
for the custom motions to be registered.
If you copy custom motions to the acc folder while the testing tool is running, you will have to close the testing tool (the emulator can continue running) and re-open it again for new motions to be shown in the list.
You can download the source code here (no longer available).
You can download the XAP here (no longer available).