Home Tutorials Hands on Sensor arrow - Simulation
Sensor arrow - Simulation
Sunday, 08 March 2009 18:54
Article Index
Sensor arrow
Co-ordinate maths
Handling the sensor values
Simulation
All Pages

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.

  1. Download the sensor simulator from here: http://code.google.com/p/openintents/downloads/list?q=sensorsimulator
  2. Unzip it and install to your emulator the SensorSimulatorSettings apk file from the /bin folder
  3. On your PC run the Sensor Simulator jar by double clicking it
  4. 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.
  5. Finally run an app on the emulator which has been written to use the PC simulator, such as the one presented here ;-)

 

Joomla Templates and Joomla Extensions by JoomlaVision.Com


 

Add comment


Security code
Refresh

Portions are modifications based on work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License. Android Academy is independent from Google. All trademarks acknowledged.
 
Glossary
We have 28 guests online