am start 命令跳转到指定窗口

先在手机上打开对应的窗口,然后运行该命令(获取当前activity的值)

adb shell dumpsys window windows | grep "Current"

以手机QQ的 界面 为例,输出如下:

  mCurrentFocus=Window{ad75007 u0 com.tencent.mobileqq/com.tencent.mobileqq.activity.SplashActivity}

com.tencent....开头的就是当前的窗口。

若想启动该窗口

#方式 1
adb shell am start -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -n com.tencent.mobileqq/com.tencent.mobileqq.activity.SplashActivity

#方式2
adb shell am start -n com.tencent.mobileqq/com.tencent.mobileqq.activity.SplashActivity

推荐第二种,毕竟短,好记。com.tencent.....是前一条命令获取的值。

猜你喜欢

转载自blog.csdn.net/qq_35425070/article/details/86675031
am