|
Sunday, 08 March 2009 18:54 |
|
Page 4 of 4
This application has a few more things to draw. The current values for the raw readings and the computed angle and tilt are shown and cycled through if you tap the screen. These are handled by appropriate functions which should be clear from the code.
Sensors without hardware
How can you test the sensors if you have no hardware? Fortunately OpenIntents offer their SensorSimulator for precisely this purpose, available here. It runs as a separate Windows/Linux application, alongside your emulator, and lets you rotate a representaion of the handset around with your mouse: the sensor values this generates are sent to the emulator just as if it was a real handset.

For completeness, heres's how to set up the sensor simulator, but it's detailed more fully here.
- Download the sensor simulator from here: http://code.google.com/p/openintents/downloads/list?q=sensorsimulator
- Unzip it and install to your emulator the SensorSimulatorSettings apk file from the /bin folder
- On your PC run the Sensor Simulator jar by double clicking it
- Back in the emulator match up the IP address shown in the SensorSimulator settings window with the one in the app on the emulator. On the emulator, you can check there is a connection using the "Testing" tab but be sure to disable this when you run your own app.
- Finally run an app on the emulator which has been written to use the PC simulator, such as the one presented here ;-)
|