Two Best Ways to Find App’s Activity and Package Name
You may need application’s package and activity name for a lot of cases. You might need that information for other tests, and you might need the package and activity name for another different reasons.
Here are 2 simple ways to find your apps package and activity name:
1. Using ADB to Get Current Focus of the Screen
Firstly, you should verify your device connection with “adb devices” command from the command promt.
Then run “adb shell” command.
Next step is running: dumpsys window displays | grep -E "mCurrentFocus" command.
See the picture above, the first part is package name, and the second part is app’s activity.
This method works for most of the cases. But in some conditions even though you found the app activity, the launcher activity of your app might not be the one with the current focus and you should catch the launcher activity really quick by running currentfocus command while launching your activity. Also, you can try the second way.
2. Using Apk Info App to Find the Package Name and Launchable Activity of Application
Download Apk Info app from Huawei AppGallery on your device and install. Check the screenshots below to find the package name and activities of your app.
You can see the package name in app details. Scroll down and find the activities part.
From activities part, mostly the first activity name is the launcher activity of your app but also that isn’t certain.
So, you can also check the activities ends with MainActivity, SplashActivity, LauncherActivity etc. That was the second way to retrieve your app’s data.
Credit: https://medium.com/huawei-developers/how-to-find-package-name-and-activity-name-of-an-application-0b6858ec4f5d

ไม่มีความคิดเห็น:
แสดงความคิดเห็น