android sensor simulator

Sensor simulator is a java standalone application that simulates sensor data and transmits them to the Android emulator. You can try out a web preview version of the Sensor simulator online or download the standalone version.

Currently, Sensor simulator sensors supports the following functions:

  • Simulates accelerometer, compass, and orientation sensors, as well as a temperature sensor.
  • Mobile device can be rotated and moved through the mouse or sliders.
  • Supports all functionality that the Android Sensor classes provide (enabled / supported sensors, sensor update rates).
  • Listens on a selectable port for incoming connection from the Android emulator.
  • Many settings available to control various aspects of the sensors.

The connection settings are set in the emulator through the sensor simulator settings. There one can also test the connection and see the data transmitted.

sensorsimulator-0-1-6-a

Try it out

  • Launch the Sensor Simulator as standalone application from the tools directory.
  • In the emulator, open OpenIntents, then tab “Settings”, and then “Sensor Simulator”.
  • There you should enter the IP address and socket as displayed in the Sensor Simulator application.
  • To test the connection, click on the “Testing” tab and press “Connect”.
  • Note: The first time you connect to the SensorSimulator, all sensors are DISABLED automatically. This is, because it is the Android application’s responsibility to enable the sensors before reading values.
  • In the emulator, enable the sensors you wish to monitor.
  • If you rotate or move the mobile device in the Sensor simulator, the values in the emulator are updated as well.
  • You can also set the sensor update rate in the emulator (see below for details).
  • When you are done, disable the sensors and press “Disconnect”.
  • You may further test the Sensor simulator with the sample application OpenGLSensors or with the API Demos Sensors.

Testing advanced features

The SensorSimulator throws the same exceptions as a real sensor would. To try this out:

  • Switch to the “Testing” tab in the sensor simulator settings and connect
  • Enable a sensor in the settings tab of the emulator.
  • Disable the same sensor in the SensorSimulator java application in the settings pane.
  • A moment later, when the Android emulator tries to read out the sensor values to update them, an exception is thrown.
  • An application developer can catch these exceptions in their program and test these exceptions properly.
  • Tip: if you want to change the supported sensors, disconnect first, then adjust the settings, and then connect again.






Comments are closed.