在不知道活动名称的情况下通过adb启动应用 [英] Launch App via adb without knowing Activity name

查看:703
本文介绍了在不知道活动名称的情况下通过adb启动应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从帖子可以通过adb启动活动shell?,我们可以通过以下方式通过adb启动Android应用程序:

From the post Is it possible to start activity through adb shell?, we can start an Android app via adb by

adb shell am start -n yourpackagename/.activityname

但是在不知道Activity名称的情况下,是否可以通过adb启动Android应用程序?例如,通过将 android.intent.action.MAIN 意向发送给程序包?也许是这样的命令:

But is it possible to start an Android app via adb without knowing the Activity name? For example, by sending the android.intent.action.MAIN intent to a package? Maybe some command like this:

adb shell am start -a android.intent.action.MAIN -n packageName

谢谢!

-Cosmo

推荐答案

是的,可以使用猴子工具通过adb shell启动应用程序。

Yes, it is possible to launch an app via adb shell making use of the monkey tool.

使用此命令中的命令

adb shell monkey -p app.package.name -c android.intent.category.LAUNCHER 1

此命令模拟应用程序图标的单击,因此意图隐式意图LAUNCHER被传递给在中声明的特定接收者应用清单(主要)

This command simulates the app icon click, so the intent implicit intent LAUNCHER is delivered to the specific receiver declared in app manifest (MAIN)

这篇关于在不知道活动名称的情况下通过adb启动应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆