1 min read · Aug 1, 2017
--
With adb (Android Debug Bridge) you can perform several tasks on a connected device (or emulator).
Today we are having a look at how you can start an activity from command line.
You can use the start command from Activity Manager (am) a.k.a the adb shell am start -n command (via adb) specifying the app package name and the component name as defined in the manifest.
For instance suppose the component name is .MainActivity and the package name is it.sendto.android.client
The complete command will be:
adb shell am start -n it.sendto.android.client/.MainActivity
You can add other parameters like ACTION (-a android.intent.action.MAIN) and CATEGORY (-c android.intent.category.LAUNCHER).
For a complete list of parameters refer to the official docs.
This story is also available on xabaras.it (in Italian)