Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Launch App via adb without knowing Activity name [duplicate]

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 

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 

Thanks!!

-Cosmo

like image 448
hackjutsu Avatar asked Apr 28 '15 22:04

hackjutsu


1 Answers

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

Using the command from this answer:

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

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

like image 148
LeuOfIridia Avatar answered Sep 29 '22 09:09

LeuOfIridia