Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I'm jumping in to provide yet another updated answer.This is what a google dev advised as well.I think it is a more solid implementation and it uses more fail-safe methods.</p> <pre><code>import java.util.Map; import java.util.TreeMap; import com.android.chimpchat.ChimpChat; import com.android.chimpchat.core.IChimpDevice; public class MonkeyRunnerTest { private static final String ADB = "/path-to-your-sdk/sdk/platform-tools/adb"; private static final long TIMEOUT = 5000; /** * @param args */ public static void main(String[] args) { Map&lt;String, String&gt; options = new TreeMap&lt;String, String&gt;(); options.put("backend", "adb"); //this is so you don't need to add adb or platform-tools to your system path options.put("adbLocation", ADB); ChimpChat chimpchat = ChimpChat.getInstance(options); //Using this method is advised as to avoid hangs,as this would wait indefinitely //Actually waitForConnection() doesn't wait indefinitely but for Integer.MAX_VALUE milliseconds, which still makes up for 596 hours IChimpDevice device = chimpchat.waitForConnection(TIMEOUT, ".*"); chimpchat.shutdown(); } } </code></pre> <p>You can see all the devices properties with:</p> <pre><code>for (String prop: device.getPropertyList()) { System.out.println(prop + ": " + device.getProperty(prop)); } </code></pre> <p>For information on the APIs you can look at the docs here: <a href="http://developer.android.com/tools/help/monkeyrunner_concepts.html#APIClasses" rel="nofollow">monkey runner api classes</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload