I am testing android app using appium. Everything is working fine but I want to know as tester that how can I get below parameters of APK :

1 - app-package

2 - app-activity

If you are using appium then you know that we have to define above 2 things in code to test app. At this stage , I need to ask value of above both to developer.

Is there any way that I can get value of those parameter directly? so it would like no need to ask to developer.

5 Answers 5


I suggest you to use adb (Android Debug Bridge) tool (part of Android SDK). So, install application under test on target Android device or emulator. And you should run application to get current activity and package name. So, after running app execute the following commands from command line (android-sdk/platform-tools/adb):

adb shell dumpsys window windows | grep -E 'mCurrentFocus|FocusedApp'

And you will get something like this:

mCurrentFocus=Window{43270790 u0 com.estrongs.android.pop/com.estrongs.android.pop.view.FileExplorerActivity} mFocusedApp=AppWindowToken{44d67b88 token=Token{435e5990 ActivityRecord{434ee320 u0 com.estrongs.android.pop/.view.FileExplorerActivity t133

So, current activity is com.estrongs.android.pop/.view.FileExplorerActivity and application package name is com.estrongs.android.pop is this case.


  1. Install apk on device or emulator
  2. Run application
  3. Execute adb shell from command line
  4. Execute command to get current activity from device(shell) shell:

dumpsys window windows | grep -E 'mCurrentFocus|FocusedApp'

I hope it helps you.

  • That command it for windows Os? Commented Mar 10, 2015 at 11:02
  • Do you need for Windows? Because grep is linux command. If you want Windows command use findstr instead of grep
    – amazpyel
    Commented Mar 10, 2015 at 11:08
  • Or you can do the following: adb shell And than: dumpsys window windows | grep -E 'mCurrentFocus|FocusedApp'
    – amazpyel
    Commented Mar 10, 2015 at 11:14
  • ok thanks a lot. Should I replace any value with your given command or can use directly as it is? Commented Mar 10, 2015 at 11:18
  • You're welcome! You may use directly. So, again. First command is adb shell and the next command after first is: dumpsys window windows | grep -E 'mCurrentFocus|FocusedApp'
    – amazpyel
    Commented Mar 10, 2015 at 11:22

If you can install 3rd party App on phone or emulator , I recommend you to install "Apk Info" It always help me to get package and activity.


App package name can be found in the application manager of the mobile device. find the app in the app manager and get the package name in the information. Activity name can be found in many ways You can always try the dalvik log/ android monitor logs/ ddms log. Just randomly tap on a button of the application the log will show you some corresponding activity for that app. There you can find the activity name in the Application tab.


You could use aapt (Android application packaging tool) to find out the name of the package and the launchable activity.Just follow these steps:

  1. Go to your command prompt, assuming you are on *NIX based systems.
  2. Then type

    aapt dump badging <path-to-apk> | grep package:\ name 

    This will give you the app-package.

    aapt dump badging <path-to-apk> | grep launchable-activity:\ name

    This will give you the lauchable activity of the app.


1)adb shell am monitor: And then start the APP that needs to obtain the package name.

2)adb shell dumpsys window | findstr mCurrentFocusView the currently running package name and startup window name.

3)adb shell dumpsys activity | findstr mFocusedActivity: Same as above.

4)adb shell “dumpsys window | grep mCurrentFocus”

5)adb shell "dumpsys activity | grep mFocusedActivity"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.