Tuesday, 20 October 2009

Android emulator: simulating the sensor inputs

On it's own the android emulator cannot simulate physically moving the device, but with additional software we can emulate movement and position of a physical Android device. The software that we'll need to do this is called Sensor simulator and can be downloaded from here.

Download this zip file and unpack it. In the bin directory is a file called sensorsimulator.jar. Just click on this and it will run the sensor simulator application that will allow you to control the movement of you virtual device. You'll also need to install the SensorSimulatorSetting.apk on your emulator and set the IP address that is shown in the sensor simulator app. To install the .apk file use this command:

adb install \bin\SensorSimulatorSettings.apk

Once you have everything installed and running, you can manipulate the orientation of you virtual phone in the sensor simulator application just by rotating the wire frame representation of the mobile phone. The sensors that are currently supported are the accelerometer, compass and orientation sensors, additionally there is also support for a temperature sensor.

To use the sensor simulator in you application takes a few simple changes to the code, which are outline here. Once this is done you can now test out your application that uses sensor data in you emulator, a much quicker process than loading it onto an actual android phone.

There's more instructions on the Sensor simulator web site, but it's all straight forward and you should be able to virtually control the orientation of you emulator in no time.


  1. Hi ,
    This is Roy.Your Sensor simulator app is very nice,am very impresed on that.I try to create android mobile captured video stream to server using RTSP/RTP.I am a android fresher please can u guide me.
    Mail ID==roy8086@gmail.com
    All ideas are welcome

  2. Where's the best place to unpack the zip? The internal structure *kinda* matches those found under "c:\android-sdk\add-ons", should I put it there?