How to Find Package Name and Activity Name of an Application?

ibrahimertanylmz
Huawei Developers
Published in
4 min readFeb 26, 2024
Phone Connected to Laptop Cover

Introduction

Hi everyone! 👋 This article will help you to find package and activity name of an android application. There are 2 simple ways to reach that information easily. Also, there are suggestions and tips to find that data from the shortest way. Check for the article and see if you have used these ways to find your app’s information.

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. For example, while you’re using test scripts in most cases Appium launches the app first and then performs some actions on it. For launching your application in automation, package name and activity name should be provided. 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.

adb devices command output

Then run “adb shell” command.

adb shell command output

Next step is running dumpsys window displays | grep -E “mCurrentFocus” command.

mCurrentFocus command output

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.

package name

You can see the package name in app details. Scroll down and find the activities part.

app details activities

From activities part, mostly the first activity name is the launcher activity of your app but also that isn’t certain.

apkinfo activities

So, you can also check the activities ends with MainActivity, SplashActivity, LauncherActivity etc. That was the second way to retrieve your app’s data 😊.

Conclusion

I hope these ways help you find your app’s information. 2 possible ways have been explained in this article to find your app’s activity and package name without too much effort. You can use both adb to get current focus of screen and apk info app to find the app details you need.

I hope, you found this article helpful and if you have any comments or questions, please let me know in the comments below. If you know another way to find app’s information, please share it in the comments so you can also help other people to resolve their issues.

--

--

ibrahimertanylmz
Huawei Developers

Android Developer @Huawei 💻, ESOGU Computer Engineering Graduate 🎓, Proactive Self-Starter, Quick Learner, Team Player 👨‍👦‍👦