Thursday, August 26, 2010

WATCH OUT: Test Accelerometer in Emulator

Conspicuously there is no way to test and manipulate the accelerometer or position sensor on apps running in the emulator.  This seems like the sort of thing the Android folks would want developers to do, but forgot to include it.


Thankfully, there is a project out there called SensorSimulator which is getting close to this capability.  It's something to watch out for and keep and eye on, but it's not ready yet.


Currently, the SensorSimulator can demonstrate how a stand-alone Java app (SensorSimulator.jar) can send false sensor settings to an app on the emulator (SensorSimulatorSettings.apk).  You fire up SensorSimultor and the emulator running SensorSimulatorSettings and you can spin around a wire-diagram of an Android device and see how the app responds.


Now, I'm confused on what the developer is calling "OpenIntents" or to what that branding refers.  They also make references to an "OpenIntents.apk", which I was never able to find.


How to Setup SensorSimulator:
1. Download SensorSimulator from this page (sensorsimulator-1.0.0-beta1.zip)
2. Unzip the file
3. Run /bin/sensorsimulator.jar (this is the stand-alone Java app)
4. Start your avd
5. Open a command window and change directory ('cd') to your android-sdk/tools folder.  Run:
'adb install SensorSimulatorSettings.apk'  (Note: you will need to give an absolute path to the .apk file)
6. Open SensorSimulatorSettings on the avd.  You should now see both applications communicating.


Now, it would be great to be able to integrate the "Android side" of their code into your app and use the stand-alone Java app to test how your app responds to acceleration, but the documentation is far from complete and I was unable to get it to work.  But keep an eye on this project.

No comments:

Post a Comment