2 Ways to find appPackage and appActivity name of your App - AutomationTestingHub (2024)

2 Ways to find appPackage and appActivity name of your App - AutomationTestingHub (1)

When you write test scripts with Appium, it usually involves launching an app first and then performing some actions on it. For example, let us suppose that you are testing WhatsApp. And your test case is to verify that you can send and receive messages. To test this, your code would first launch WhatsApp and then it would verify your test case.

But how do you launch WhatsApp with Appium? Or to put this question in a different way, how would Appium recognize which app on your phone is WhatsApp? You might have tens of apps installed on your mobile device. Hence, Appium needs to identify the correct app and then open it.

Let us first see how you would do this manually? You would scroll through the list of apps installed on your phone, and then you will open the app which has the name ‘WhatsApp’. Well, Appium also follows a similar process. When you write your code, you would need to provide the name of the app, and Appium would then launch that app.

Things get a little technical here. You just can’t provide the app name as ‘WhatsApp’ in your Appium code. Internally, all the mobile apps use a different technical name. You would need to provide this technical name (also known as package name). Together with this package name, you will also need to provide the activity name of the app.

2 Ways to find appPackage and appActivity name of your App - AutomationTestingHub (2)

This article lists down 2 different methods using which you can find appPackage and appActivity names of your app under test. You can use any of these methods to find out the package and activity names of your app. Before we start with these 2 methods, let’s first get some more detail about appPackage and appActivity.

What is appPackage and appActivity name ?

appPackage:

In very basic terms, appPackage is the technical name of the app provided by its developers. It’s actually the top level package under which all the code for the app resides.

For example, appPackage for ‘YouTube’ for Android is ‘com.google.android.youtube’. For Facebook, this name is ‘com.facebook.katana’ and for WhatsApp, the appPackage is – ‘com.whatsapp’. So if you want to launch Facebook from Appium, you would need to provide it’s name as ‘com.facebook.katana’ in Appium.

appActivity:

Again, speaking in very basic terms appActivity refers to the different functionalities that are provided by the app.

For example, WhatsApp provides multiple functionalities such as chats, status, calls, setting profile photo, etc. Each of these functionalities are represented by an appActivity.

Together with these activities, every app has a main activity which is sort of the main screen you see when you launch the app. For WhatsApp, it is the Chats window, and for Facebook it would be the Wall. When you launch the app with Appium, it needs to know which activity has to be launched. And you would need to provide the main activity name (the activity which represents the app’s main screen)

With this basic and important understanding on about app package and app activity, let us start with the different methods with which you can identify this information of your app.

Which app are we going to use in our Tutorial series?

With our Appium Tutorial series, we are trying to keep things very simple so that its easier for Appium beginners to follow our articles. Keeping this in mind, we use the Google Play Store and find its appPackage & appActivity name. The main reason for using this app is that it’s available on all android mobile devices.

2 Ways to find appPackage and appActivity name of your App - AutomationTestingHub (3)

Let us now start with the first method on how to identify the appPackage and appActivity name for Play Store app.

Method 1: Using ‘mCurrentFocus’ or ‘mFocusedApp’ in Command Prompt

Step 1: Unlock your mobile device and connect it to your computer using USB cable

Step 2: Open Command Prompt and run ‘adb devices’ command. We are running this command to just make sure that your mobile is properly connected.

Step 3: Once you run ‘adb devices’ command, you should see that it displays the list of attached devices as shown in the below image (the actual device name that you see would be different based on what mobile phone you use) –

2 Ways to find appPackage and appActivity name of your App - AutomationTestingHub (4)

Step 4: Run ‘adb shell’ command. After running this command, the command prompt should look something like this –

2 Ways to find appPackage and appActivity name of your App - AutomationTestingHub (5)

Step 5: Now in your mobile phone, open the app for which you want to find the appPackage and appActivity. Since we are doing this for Play Store, hence we will open “Play Store” on our mobile phone.

Note: Please make sure that you open the app before going to the next step, because command in the next step would provide the details only for the app which is currently in focus.

Step 6: Now run this command: dumpsys window displays | grep -E ‘mCurrentFocus’

Step 7: The above command would display the details of the app which is currently in focus. From that, you can figure out the appPackage and appActivity name as per the below image –

2 Ways to find appPackage and appActivity name of your App - AutomationTestingHub (7)

appPackage starts with com. and ends before backshash (/). So from the above image, appPackage name is – com.android.vending

appActivity starts after the backslash (/) and goes till the end. From the above image, appActivity name is – com.android.vending.AssetBrowserActivity

Step 8: There is one more similar command that provides the appPackage and appActivity name. This command adds some additional details before and after the package name & activity name, but you can still try it out just to verify that the results from the above command are same. This command is – dumpsys window displays | grep -E ‘mFocusedApp’ and the output of this command is shown below –

2 Ways to find appPackage and appActivity name of your App - AutomationTestingHub (8)

In this example, where we used mFocusedApp, appActivity name is shown as a relative name, i.e., it doesn’t start with com. In such cases, you would need to add com…. at the beginning to get the complete activity name. So in our case, complete activity name for .AssetBrowserActivity would be com.android.vending.AssetBrowserActivity

Method 2: Using APK Info app

APK Info is an app which you can download from Play Store, and it will provide the appPackage and appActivity name of any app which is installed on your mobile device.

Step 1: Download “APK Info” app from Google Play Store on your android mobile.

2 Ways to find appPackage and appActivity name of your App - AutomationTestingHub (9)

Step 2: Once you have successfully installed APK Info app, open it and check that it lists down all the apps that you have on your phone. Then search for “Google Play Store” in the search pane as shown below

2 Ways to find appPackage and appActivity name of your App - AutomationTestingHub (10)

Step 3: Long press on the “Google Play Store” application icon inside the APK Info app till it displays the list of options as shown below –

2 Ways to find appPackage and appActivity name of your App - AutomationTestingHub (11)

Step 4: Click the option “Detailed Information” option. It would show the detailed log for the app.

Here, check the APK path section. This sections displays the “appPackage” name as highlighted in red block in the below image –

2 Ways to find appPackage and appActivity name of your App - AutomationTestingHub (12)

Note: Skip any number at the postfix of the name (eg: here its “-2”). So, the appPackage name in this case is – com.android.vending

Step 5: Then to find the appActivity name of the app, scroll down to the sub-section “Activities”. This sub-section displays all the activities that are available for the app. From this list, you have to look for the activity which has “MainActivity” or “Main” or “Login” in the activity name.

2 Ways to find appPackage and appActivity name of your App - AutomationTestingHub (13)

Here “com.google.android.finsky.activities.MainActivity” is the appActivity name for the Play Store app.

Since Play Store is a full fledged app, so it contains a lot of activities. However, if you are testing a small app or some app which is in development phase, then it would not contain these many activities. So it would be easier to identify the main activity in that case. If you still find it difficult to identify the main activity, then you can always check back with your developers or use the first method that we have provided in this article.

With this, we complete our article on identifying appPackage and appActivity name for the app you want to test. Let us know if you face any issues while identifying these properties of any particular app with these methods. We would also love to hear from you, if you have any feedback for us, or if you have any other way which can help identify these properties.

We are continuously adding more articles to our tutorial series. You can check it out here – Appium Tutorials

2 Ways to find appPackage and appActivity name of your App - AutomationTestingHub (2024)

FAQs

How do I find the Apppackage and Appactivity name of my app? ›

  • Open 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=?).
Sep 23, 2020

How do I find my app package name? ›

If only the compiled . apk file is available, mobile testers can use the Android Asset Packaging Tool (aapt) to get the package name of the app. AAPT is located in the build-tools folder of the installed Android SDK version. The path to aapt may look as follows /Users/lana/Android/sdk/build-tools/33.0.

How to get package and activity name in Android? ›

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. ...
  2. Using Apk Info App to Find the Package Name and Launchable Activity of Application.
Feb 26, 2024

How to get the activity name in Android using ADB? ›

Finding out package and activity name via adb for appium...
  1. Ensure adb is set up and on path.
  2. Get app package name.
  3. Get start activity for use. Get a list of installed packages and path to base apk. Get the base.apk file for the app. Get the activity name using aapttool.
  4. Conclusion.
Apr 24, 2020

What is AppPackage and AppActivity? ›

Android App package is the destination of your apk file or installed file in your Android device, whereas Android App Activity is the destination path of the screen which will be launched by Appium server.

How to find mainactivity of apk? ›

In order to retrieve the list of activities and identify the Launch Activity from an APK file, you will need to use a tool called AAPT (Android Asset Packaging Tool). AAPT is a command-line tool that is included with the Android SDK (Software Development Kit).

What is application package name? ›

The package name of your Android app is the unique identifier that allows it to be identified on Google Play and on your phone. The package name of your application must be different from all the applications installed on an Android phone. The package name appears in the URL of your application on the Play Store.

How do I create an app package name? ›

The package name should be unique and may contain uppercase or lowercase letters ('A' through 'Z'), numbers, and underscores ('_'). However, individual package name parts may only start with letters. For more information: Android Developers - Java Package.

How do I find appium appActivity? ›

Method 2: Using APK Info app

Step 1: Download “APK Info” app from Google Play Store on your android mobile. Step 4: Click the option “Detailed Information” option. It would show the detailed log for the app. Step 5: Then to find the appActivity name of the app, scroll down to the sub-section “Activities”.

Where can I find package name in Android Studio? ›

The package for each android application resides within the src/main/java directory of the application module.

How do I find my Android app package name? ›

You can find an app's package name in the URL of your app's Google Play Store listing. For example, the URL of an app page is play.google.com/store/apps/details? id=com. example.

How do I see app activity on android? ›

Manage your Google Account.

Tap Data & privacy. Under "History settings," tap Web & App Activity.

How to find activity in android? ›

Find activity

Under "History settings," tap My Activity. To access your activity: Browse your activity, organized by day and time.

Where is the app package name in Google Play console? ›

Verify the app package name
  1. Sign in to the Google Play Console.
  2. Make sure the app exists in the All applications list. If the app isn't there, create it and go through the publishing steps below.
  3. The app package name is written in the App name column under the app name itself.
Mar 14, 2024

How can I see all my app activity? ›

Manage your Google Account.

Tap Data & privacy. Under "History settings," tap Web & App Activity.

What is Android app package? ›

An APK file (Android Package Kit file format) is the file format for applications used on the Android operating system (OS). An APK file contains all the data an app needs, including all of the software program's code, assets and resources.

How do you check if an app name is already taken? ›

Before reserving a name, it's important to research existing apps to see if there are any similar names already in use. This can be done by searching the app stores, as well as conducting a Google search.

Top Articles
Latest Posts
Article information

Author: Wyatt Volkman LLD

Last Updated:

Views: 5954

Rating: 4.6 / 5 (46 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: Wyatt Volkman LLD

Birthday: 1992-02-16

Address: Suite 851 78549 Lubowitz Well, Wardside, TX 98080-8615

Phone: +67618977178100

Job: Manufacturing Director

Hobby: Running, Mountaineering, Inline skating, Writing, Baton twirling, Computer programming, Stone skipping

Introduction: My name is Wyatt Volkman LLD, I am a handsome, rich, comfortable, lively, zealous, graceful, gifted person who loves writing and wants to share my knowledge and understanding with you.