Saturday, February 5, 2011


I was looking for a way on how to remotely execute touch events on an Android device/emulator. I couldn't find something that met all my requirements but came through this great tool that Android SDK offers: monkeyrunner.

It is quite simple to write a sequence of commands to execute: open an activity, press a key, touch the screen, everything (or almost everything?) you can do with a device. Additionally to sending commands, it is also possible to take screenshots of the screen to check if it is showing the expected behavior. Quite nice.

Information about monkeyrunner and a sample script can be found this page:

Documentation is available on these URLs:

Ohh... and by the way, the sample code has some problems:
1. the activity to launch has to be in this format:
2. device.takeSnapShot should be: device.takeSnapshot()

Now.. wouldn't it be great if there was some kind of cloud service that executed uploaded scripts into a wide variety of devices? ;-)