Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find out activity names in a package? android. ADB shell

Tags:

I can get a list of all the packages installed on my android, but to open an application I need the activity name and the package name. Is there a way to list all the activities in a package through adb shell. The android manifest file pulled from the phone doesn't help as it is the binary version of the file, therefore containing no meaningful information. And LAUNCHER 1, or main activity works for a lot of apps but not all. Therefore, I do need to find out the exact name of activities within an application.

Thanks.

like image 405
Abdulrehman Avatar asked Oct 30 '15 16:10

Abdulrehman


People also ask

How do I find my adb Activity name?

Currently, it is not possible in ADF to get the activity name dynamically. But, as you want the failed activity name, we can get the name from the error itself (in this case).

How do I find my package name and activity name?

Finding an Android app's package name and Activity FollowOpen play.google.com in your web browser. Use the search bar to look for the app for which you need the package name. Open the app page and look at the URL. The package name forms the end part of the URL (i.e. after the id=?).

How do I check my package list on Android?

To list all the installed packages on an Android device, use the following syntax. To list only the system packages, use the “ -s ” option. To list only 3rd party (or non-system) packages, use the “ -3 ” option. To list the package names as well as the path to the installed APK files, use the “ -f ” option.


2 Answers

Here is how:

adb shell dumpsys package | grep -i " + (enter package name)  + " |grep Activity

This will give all the activities in the given android package.

like image 172
tejaswini teju Avatar answered Oct 08 '22 01:10

tejaswini teju


To expand on tejaswini teju's answer, if you want to get all activities of a package and not just those containing the string "Activity", you'll have to do:

adb shell dumpsys package | grep -Eo "^[[:space:]]+[0-9a-f]+[[:space:]]+com.whatsapp/[^[:space:]]+" | grep -oE "[^[:space:]]+$"

replacing com.whatsapp with your package name.

like image 30
Forivin Avatar answered Oct 07 '22 23:10

Forivin