How to identify Activity name and start the activity of installed app

This posts lets you identify name of the activity from the installed application and then use the package name and activity name to start the applications Activity.

List all the installed applications using

$ adb shell pm list packages -f

From this above command, you will get the path and apk name of application you want to analyse to find out the launchable activity name.

Pull the apk using path listed in above command,

$ adb pull "apk_path/apk_name.apk" . 
$ aapt dump badging apk_name.apk

You will see a message like, launchable-activity: name=’package_name.MainActivity’ in output of “aapt”

For example, if we consider our application apk

$ aapt dump badging myApplication.apk | grep launchable-activity
launchable-activity: name='com.example.myapplication.MainActivity'  label='' icon=''

As we can see, it printed the launchable activity as “com.example.myapplication.MainActivity” of which package name as “com.example.myapplication” and activity name is “MainActivity”

Now, we can use this same activity name from adb command line to launch the activity as,

$ am start -n com.example.myapplication/com.example.myapplication.MainActivity 

Leave a Comment