Android 使用ADB命令启动浏览器并访问指定的URL

今天逛了看了几个小时的博客总算是找到了在这里做个记录:

    public void SendGET() throws UiObjectNotFoundException {
        String urlStr = "https://chat.whatsapp.com/JAtjHKiOxiZExdhP04Jfa2";//要访问的 URL
        String opCmd = " am start -a android.intent.action.VIEW -d " + urlStr;//ADB 命令
        SystemClock.sleep(10000);
        CommandExecution.CommandResult aaa = CommandExecution.execCommand(opCmd, true);
        //CommandExecution执行ADB 命令的封装类  公司的私密代码我就不贴出来了
    }

你可能感兴趣的:(android)