Is there a way to get the launchable activity for a package from using adb
? For an unroot phone (i.e. without having the pull the apk from /data/app
directory and inspect with appt
).
I tried dumpsys, but it does not include information on default launchable activity.
Thanks
sample:
I didn't find it listed so updating the list.
You need to have the apk installed and running in front on your phone for this solution:
Windows CMD line:
adb shell dumpsys window windows | findstr <any unique string from your pkg Name>
Linux Terminal:
adb shell dumpsys window windows | grep -i <any unique string from your Pkg Name>
OUTPUT for Calculator package would be:
Main part is, First Line:
Window #7 Window{39ced4b1 u0 com.android.calculator2/com.android.calculator2.Calculator}:
First part of the output is package name:
com.android.calculator2
Second Part of output (which is after
/
) can be two things, in our case its:com.android.calculator2.Calculator
<PKg name>.<activity name>
=<com.android.calculator2>.<Calculator>
so
.Calculator
is our activityIf second part is entirely different from Package name and doesn't seem to contain pkg name which was before
/
in out output, then entire second part can be used as main activity.Here is another way to find out apps package name and launcher activity.
Step1: Start "adb logcat" in command prompt.
Step2: Open the app (either in emulator or real device)
You don't need root to pull the apk files from
/data/app
. Sure, you might not have permissions to list the contents of that directory, but you can find the file locations of APKs with:Then you can use
adb pull
:and then
aapt
to get the information you want:Since Android 7.0 you can use
adb shell cmd package resolve-activity
command to get the default activity of an installed app like this: