Tips‎ > ‎

    Hardware Emulation

    The Android emulator has experimental supports for
    • Sensors
    • Multi-touch
    Note: With Tools r18, both SdkController### apps have been merged into a single app that can do both. You will still need to do both port forwarding for now, so read on. We'll fix this in r20.

    Sensors

    For a realistic sensor emulation, the emulator uses a connection with an actual Android device running the SdkControllerSensor application. The application monitors changes in the sensors on the device, and transmits them to the emulator. The emulator then injects those changes into the guest system image. This requires Android 4.0, system image revision 2.

    The SdkControllerSensor application source code is located in $SDK/tools/apps/SdkController/
    ADB port forwarding is used for the data transfer between the device and the emulator.

    Here is how you enable sensor emulation:
    1. Connect a device to the host machine via USB, make sure USB debugging is enabled on the device.
    2. Start the SdkControllerSensor application on the device.
    3. Use application’s UI to select sensors that you want to emulate.
    4. Run adb forward tcp:1968 tcp:1968 in the host’s shel / command line.
    5. Start the emulator.
    Note that port forwarding between the host and the device can be fragile. If you see that sensor events have stopped in the emulator, run the adb forward tcp:1968 tcp:1968 command again. This should restore the connection.

    Multi-Touch

    The emulator supports multi-touch input, as an experimental feature in r17, using a tethered Android device running the SdkControllerMultitouch appplication. The application contains an activity that monitor touch inputs and sends them to the emulator. This requires an Android 4.0 or later system image.
    The activity displays the content of the emulator screens to help with interactivity. It is recommended to enable "show touches" in the Developer section of the Settings on the emulator to see exactly where the touches are sent.

    The SdkControllerSensor application source code is located in $SDK/tools/apps/SdkControllerMultitouch/

    Port forwarding is used again. This time the port is 1969.
    Important: When creating the AVD, make sure to add the hardware property Multi-touch screen support, and set it to true.

    Limitations: If the emulator runs with hardware GPU, the application running on the tethered device won't show the emulator framebuffer.