The Android SDK has an API for sending commands to the phone called Monkeyrunner. It appears to be a Python API. Is there anyway I can use it in a Java application?
Well I have been trying to do this, here is what I found (Thanks to google and some help from members on the internet)
Here is a little Java program that uses monkeyrunner to print the name of the device
import com.android.monkeyrunner.MonkeyDevice;
import com.android.monkeyrunner.adb.AdbBackend;
public class Monk {
public static void main(String[] args) {
// TODO code application logic here
Monk monk=new Monk();
monk.demo();
}
public void demo()
{
AdbBackend ab = new AdbBackend();
MonkeyDevice device = ab.waitForConnection();
//Print Device Name
System.out.println(device.getProperty("build.model"));
device.dispose();
}
}
For the above code too work, I needed to include the following jars monkeyrunner, ddmlib, jython, guavalib, sdklib.