public String execCmd(String cmd) throws java.io.IOException {
    Process proc = Runtime.getRuntime().exec(cmd);
    java.io.InputStream is = proc.getInputStream();
    java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
    String val = "";
    if (s.hasNext()) {
        val = s.next();
    }
    else {
        val = "";
    }
    return val;
  }
Requires ANDROID_HOME to be set in enviroment.
@throws Exception
selendroid-test-app/src/test/java/io/selendroid/nativetests/BackgroundAppTest.java