WP7 Shake, Rattle and Roll

One of the nice features of the new WP7 emulator is the ability to emulate motion on the emulated device. Unfortunately, there is only one prerecorded action and no documentation on how to add your own. Thanks to one intrepid explorer, Den Delimarsky, he created an app to capture the motion http://dotnet.dzone.com/articles/custom-accelerometer-motions.

In that article, he left breadcrumbs to where the actions are stored (I found them under Program Files (x86) ) and it is just a matter of creating new files in the directory to add actions. As a quick test, I copied the default shake action and renamed the copies as rattle and roll. Rerunning the emulator and there was now three actions… rattle, roll, shake (isn’t alphabetical order fun).

So what is in the file? It is a standard XML file in this format.

<?xml version=”1.0″ encoding=”utf-8″?>
<WindowsPhoneEmulator xmlns=”http://schemas.microsoft.com/WindowsPhoneEmulator/2009/08/SensorData“>
<Header version=”1″/>
<AccData offset=”21″ x=”-00.084″ y=”-01.02100003″ z=”-00.41700000″ />
<AccData offset=”42″ x=”-00.142″ y=”-00.95099998″ z=”-00.39700001″ />

The actual data records are the ones with the AccData keywords. The offset tag starts with 21 for the first record and increases by 21 for all the subsequent ones. The x, y and z tags are the actual motions. They appear to be delta changes. Though they appear to have eight decimal places, there is no need for that precision.

So hopefully this is enough information to help you create some actions.

John Marshall… Visio MVP       Visio.MVPs.org

Published by johnvisiomvp

The original Visio MVP. I have worked with the Visio team since 1993