Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save schrmh/a58d622ea9110402f8f3c3fda3a9c84c to your computer and use it in GitHub Desktop.
Save schrmh/a58d622ea9110402f8f3c3fda3a9c84c to your computer and use it in GitHub Desktop.
ADB command to show Android app package & main activity name running in a connected real device
$ adb shell dumpsys activity activities | sed -En -e '/Stack #/p' -e '/Running activities/,/Run #0/p'
$ adb shell dumpsys activity activities | sed -En -e '/Stack #/p' -e '/Running activities/,/Run #0/p'

  Stack #1:
    Running activities (most recent first):
      TaskRecord{c90e20c #265 A=com.hootsuite.droid.full U=0 sz=1}
        Run #0: ActivityRecord{ec0802b u0 com.hootsuite.droid.full/.app.ui.DockingActivity t265}
  Stack #0:
    Running activities (most recent first):
      TaskRecord{55974a7 #211 A=com.huawei.android.launcher U=0 sz=1}
        Run #0: ActivityRecord{586f966 u0 com.huawei.android.launcher/.Launcher t211}

So, in above case, the app package is com.hootsuite.droid.full and the main activity is .app.ui.DockingActivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment