[英]How to find out activity names in a package? android. ADB shell
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.我可以获得安装在我的 android 上的所有包的列表,但是要打开应用程序,我需要活动名称和包名称。 Is there a way to list all the activities in a package through adb shell.
有没有办法通过 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.
从手机中提取的 android 清单文件没有帮助,因为它是文件的二进制版本,因此不包含任何有意义的信息。 And LAUNCHER 1, or main activity works for a lot of apps but not all.
LAUNCHER 1 或主要活动适用于很多应用程序,但不是全部。 Therefore, I do need to find out the exact name of activities within an application.
因此,我确实需要找出应用程序中活动的确切名称。
Thanks.谢谢。
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.这将给出给定 android 包中的所有活动。
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:要扩展 tejaswini teju 的答案,如果你想获得一个包的所有活动,而不仅仅是那些包含字符串“Activity”的活动,你必须这样做:
adb shell dumpsys package | grep -Eo "^[[:space:]]+[0-9a-f]+[[:space:]]+com.whatsapp/[^[:space:]]+" | grep -oE "[^[:space:]]+$"
replacing com.whatsapp
with your package name.用你的包名替换
com.whatsapp
。
Expanding on tejaswini teju answer which didn't work because the grep command specified couldn't find anything.扩展tejaswini teju答案不起作用,因为指定的 grep 命令找不到任何东西。
This worked for me: adb shell dumpsys package | grep $packagename | grep Activity
这对我有用:
adb shell dumpsys package | grep $packagename | grep Activity
adb shell dumpsys package | grep $packagename | grep Activity
Where packagename
can be a part of the package name, such as com.whatsapp
or whatsapp
其中
packagename
可以是包名的一部分,例如com.whatsapp
或whatsapp
It may print duplicate results.它可能会打印重复的结果。
Package name itself can help filter & I do that to grab userid all the time.包名称本身可以帮助过滤,我这样做是为了一直获取用户 ID。 Wonder why no one uses it for activity.
想知道为什么没有人将它用于活动。 So here goes
所以这里
Give me all the packages activities followed by specific filter eg filter 5b2a894
for package com.whatsapp
.给我所有的包活动,然后是特定的过滤器,例如
filter 5b2a894
package com.whatsapp
。 Change that name as needed.根据需要更改该名称。
Without collapsing不倒塌
adb shell dumpsys package com.whatsapp | grep -i activity
Collapse further进一步折叠
collapse this further to exclude filter 5b2a894
type components , remove duplicates and stack them up nicely进一步折叠以排除
filter 5b2a894
类型的组件,删除重复项并将它们很好地堆叠起来
adb shell dumpsys package com.whatsapp | grep -i activity | awk 'NF{NF-=1};1' | sort | uniq
Output - Without collapsing输出 - 不折叠
Activity Resolver Table:
2a9801d com.whatsapp/.accountsync.CallContactLandingActivity filter 94597dd
72cf777 com.whatsapp/.identity.IdentityVerificationActivity filter 8aa4179
bfefa14 com.whatsapp/.accountsync.ProfileActivity filter c096fb4
2a9801d com.whatsapp/.accountsync.CallContactLandingActivity filter 94597dd
7ebef6a com.whatsapp/.VoiceMessagingActivity filter 2e8e40
7ebef6a com.whatsapp/.VoiceMessagingActivity filter 2e8e40
bfd6630 com.whatsapp/.HomeActivity filter 885a8e6
bfd6630 com.whatsapp/.HomeActivity filter 885a8e6
bfefa14 com.whatsapp/.accountsync.ProfileActivity filter c096fb4
2a9801d com.whatsapp/.accountsync.CallContactLandingActivity filter 94597dd
2a9801d com.whatsapp/.accountsync.CallContactLandingActivity filter 94597dd
7ebef6a com.whatsapp/.VoiceMessagingActivity filter 2e8e40
7ebef6a com.whatsapp/.VoiceMessagingActivity filter 2e8e40
bfd6630 com.whatsapp/.HomeActivity filter 885a8e6
bfd6630 com.whatsapp/.HomeActivity filter 885a8e6
72cf777 com.whatsapp/.identity.IdentityVerificationActivity filter 8aa4179
63a60ae com.whatsapp/.payments.receiver.IndiaUpiPayIntentReceiverActivity filter e250cc6
e5aadb3 com.whatsapp/.AcceptInviteLinkActivityDeepLink filter f736d72
e5aadb3 com.whatsapp/.AcceptInviteLinkActivityDeepLink filter f736d72
bfefa14 com.whatsapp/.accountsync.ProfileActivity filter c096fb4
2a9801d com.whatsapp/.accountsync.CallContactLandingActivity filter 94597dd
bfd6630 com.whatsapp/.HomeActivity filter 2432e27
bfd6630 com.whatsapp/.HomeActivity filter 7d4b8d4
bfd6630 com.whatsapp/.HomeActivity filter ddb7a7d
dec987 com.whatsapp/.stickers.AddThirdPartyStickerPackActivity filter d06eebe
dc42a01 com.whatsapp/.accountsync.LoginActivity filter 6cef487
e73f6e8 com.whatsapp/.migration.export.ui.ExportMigrationActivity filter 657ed7f
c62872c com.whatsapp/.settings.SettingsDataUsageActivity filter 6f2ee9e
1af6ddf com.whatsapp/.authentication.AppAuthenticationActivity filter da5bb1f
24d752a com.whatsapp/.camera.CameraActivity filter 7aa85c3
bfefa14 com.whatsapp/.accountsync.ProfileActivity filter c096fb4
2a9801d com.whatsapp/.accountsync.CallContactLandingActivity filter 94597dd
7ebef6a com.whatsapp/.VoiceMessagingActivity filter 2e8e40
bfd6630 com.whatsapp/.HomeActivity filter 885a8e6
72cf777 com.whatsapp/.identity.IdentityVerificationActivity filter 8aa4179
Output colapsed输出已折叠
1af6ddf com.whatsapp/.authentication.AppAuthenticationActivity filter
24d752a com.whatsapp/.camera.CameraActivity filter
2a9801d com.whatsapp/.accountsync.CallContactLandingActivity filter
63a60ae com.whatsapp/.payments.receiver.IndiaUpiPayIntentReceiverActivity filter
72cf777 com.whatsapp/.identity.IdentityVerificationActivity filter
7ebef6a com.whatsapp/.VoiceMessagingActivity filter
Activity Resolver
bfd6630 com.whatsapp/.HomeActivity filter
bfefa14 com.whatsapp/.accountsync.ProfileActivity filter
c62872c com.whatsapp/.settings.SettingsDataUsageActivity filter
dc42a01 com.whatsapp/.accountsync.LoginActivity filter
dec987 com.whatsapp/.stickers.AddThirdPartyStickerPackActivity filter
e5aadb3 com.whatsapp/.AcceptInviteLinkActivityDeepLink filter
e73f6e8 com.whatsapp/.migration.export.ui.ExportMigrationActivity filter
This what working for me:这对我有用:
adb shell "dumpsys package | grep -i 'com.android.calendar' | grep 'Activity'"
I am using windows 10.我正在使用 Windows 10。
It will gives like below:它会给出如下:
5697056 com.android.calendar/.event.EditEventActivity
e7285bc com.android.calendar/.homepage.AllInOneActivity
5697056 com.android.calendar/.event.EditEventActivity
9a9edbd com.android.calendar/.event.EventInfoActivity
5697056 com.android.calendar/.event.EditEventActivity
5697056 com.android.calendar/.event.EditEventActivity
9a9edbd com.android.calendar/.event.EventInfoActivity
e7285bc com.android.calendar/.homepage.AllInOneActivity
a148bb4 com.android.calendar/com.miui.calendar.event.travel.EmptyTravelActivity
e8883dd com.android.calendar/com.miui.calendar.web.WebViewActivity
26664e6 com.android.calendar/com.miui.calendar.event.loan.LoanDetailActivity
2c883c5 com.android.calendar/com.miui.calendar.holiday.HolidayDetailActivity
304220e com.android.calendar/.agenda.AgendaActivity
31751c3 com.android.calendar/com.miui.calendar.test.ModuleTestActivity
408a44b com.android.calendar/com.miui.calendar.event.travel.FlightDetailActivity
5e67a3c com.android.calendar/com.miui.calendar.detail.CardDetailActivity
6befe28 com.android.calendar/com.miui.calendar.event.travel.TrainDetailActivity
6e4511a com.android.calendar/com.miui.calendar.insertevent.InsertEventActivity
83b3a27 com.android.calendar/com.miui.calendar.event.movie.MovieDetailActivity
879f009 com.android.calendar/.selectcalendars.SelectVisibleCalendarsActivity
ba96a40 com.android.calendar/com.miui.calendar.event.travel.FlightCheckInActivity
bb29741 com.android.calendar/com.miui.calendar.event.credit.CreditDetailActivity
ca3e972 com.android.calendar/com.miui.calendar.event.electricity.ElectricityBillDetailActivity
e19d4d4 com.android.calendar/com.miui.calendar.event.hotel.HotelDetailActivity
fd0667d com.android.calendar/com.miui.calendar.event.gas.GasBillDetailActivity
ff6f42f com.android.calendar/com.miui.calendar.huangli.HuangLiDetailActivity
e7285bc com.android.calendar/.homepage.AllInOneActivity
134bba0 com.android.calendar/.settings.CalendarSettingsActivity
e7285bc com.android.calendar/.homepage.AllInOneActivity
9a9edbd com.android.calendar/.event.EventInfoActivity
de026b2 com.android.calendar/com.miui.calendar.detail.GlobalHoroscopeDetailActivity
e7285bc com.android.calendar/.homepage.AllInOneActivity
304220e com.android.calendar/.agenda.AgendaActivity
e7285bc com.android.calendar/.homepage.AllInOneActivity
5697056 com.android.calendar/.event.EditEventActivity (2 filters)
9a9edbd com.android.calendar/.event.EventInfoActivity
e7285bc com.android.calendar/.homepage.AllInOneActivity
5697056 com.android.calendar/.event.EditEventActivity (2 filters)
This discussion took me to the solution I needed.这次讨论让我找到了我需要的解决方案。 Thanks to everyone
谢谢大家
adb shell "dumpsys package "com.android.settings" | grep -i activity | grep -i mobile | awk '{print $2}' | sort | uniq"
adb shell "dumpsys package "com.android.settings" | grep -i 活动 | grep -i mobile | awk '{print $2}' | sort | uniq"
com.android.settings/.Settings$MobileDataUsageListActivity com.android.settings/.Settings$MobileNetworkActivity com.android.settings/.Settings$MobileNetworkListActivity
com.android.settings/.Settings$MobileDataUsageListActivity com.android.settings/.Settings$MobileNetworkActivity com.android.settings/.Settings$MobileNetworkListActivity
To bring the question further : Is there a way to list the Package/Activity involved while doing an operation on the device ?进一步提出问题:有没有办法列出在设备上进行操作时涉及的包/活动?
For example : Open Settings > Mobile Networks > Toggle VoLTE switch例如:打开设置 > 移动网络 > 切换 VoLTE 开关
I tried "logcat -c" / "logcat -d" and that doesn't do it.我试过“logcat -c”/“logcat -d”,但没有这样做。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.