使用到的jar包均在android sdk中,chimpchat.jar,ddmlib.jar,guavalib.jar,sdklib.jar

代码
import java.util.TreeMap;import com.android.chimpchat.ChimpChat;import com.android.chimpchat.core.IChimpDevice;public class JavaMonkey {        private static final String ADB = "/home/eamon/android-sdk/android-sdk-linux_x86/platform-tools/adb";        private static final long TIMEOUT = 5000;        private ChimpChat mChimpchat;        private IChimpDevice mDevice;        /**         * Constructor         */        public JavaMonkey() {                super();        TreeMap<String, String> options = new TreeMap<String, String>();        options.put("backend", "adb");        options.put("adbLocation", ADB);        mChimpchat = ChimpChat.getInstance(options);        }        /**         * Initializes the JavaMonkey.         */        private void init() {                mDevice = mChimpchat.waitForConnection(TIMEOUT, ".*");                if ( mDevice == null ) {                        throw new RuntimeException("Couldn't connect.");                }                mDevice.wake();        }        /**         * List all properties.         */        private void listProperties() {                if ( mDevice == null ) {                        throw new IllegalStateException("init() must be called first.");                }                                mDevice.drag(10, 10, 140, 280, 136, 2);                for (String prop: mDevice.getPropertyList()) {                        System.out.println(prop + ": " + mDevice.getProperty(prop));                }        }        /**         * Terminates this JavaMonkey.         */        private void shutdown() {                mChimpchat.shutdown();                mDevice = null;        }        /**         * @param args         */        public static void main(String[] args) {                final JavaMonkey javaMonkey = new JavaMonkey();                javaMonkey.init();                javaMonkey.listProperties();                javaMonkey.shutdown();        }}



此方法可以拖拽statusbar,可以获取手机基本信息等。

更多相关文章

  1. android用于打开各种文件的intent
  2. Android实现发短信@彩信功能
  3. android获得屏幕高度和宽度
  4. 总结系列-Android的文件系统
  5. Android中获得SD卡中的值
  6. android设备信息获取
  7. Android(安卓)获取系统权限的代码
  8. 获取Android版本信息和电话信息
  9. Android中获得SD卡中的值

随机推荐

  1. Android基础知识总结(转载)
  2. 在Android中创建启动界面 编辑
  3. Ubuntu中编译Android(安卓)JellyBean 4.2
  4. (2) 搭建 Android 系统开发环境
  5. android 播放assets目录内的音乐,及使用Se
  6. YOLOv5-pytorch迁移至android
  7. Android RxJava与Retrofit与RecyclerView
  8. 了解android studio
  9. android 关于listview scrollview 底部
  10. Ubuntu下编译AndroidNDK项目报arm-linux-