stack twitter tryhackme rss linkedin cross

Wilco van Esch

Skip to main content

Search results

    Finding the appPackage and appActivity values for an app on a connected device

    Say you're looking to run Appium tests against an app on an Android device connected to your desktop and you need to know the appPackage and appActivity values for the app.

    Assuming you have the Android SDK installed (and you have the SDK's platform-tools directory in your PATH environment variable, if you're on Windows), you can run the following from the command line.

    adb devices

    This should return the hostname of the device you have connected.

    adb shell

    This will allow us to send commands to the device.

    Make sure that the app under test is started and in focus on the device, then run the following.

    dumpsys window windows | grep -E ‘mCurrentFocus|mFocusedApp’

    Example output:

    mCurrentFocus=Window{31ee112 u0 d0
    mFocusedApp=AppWindowToken{b5717d6 token=Token{65b7ff1
    ActivityRecord{2c5b98 u0
    UnityPlayerNativeActivity t39}}}`

    For this example, the values for appPackage and appActivity are:

    appPackage: com.Client.Appname

    appActivity: com.unity3d.player.UnityPlayerNativeActivity