Is there a way to print the current back stack of the current task in an Android app? In particular, I want to understand when an activity is popped off the stack after its onDestroy() is called.
To improve on Paul's answer and see data relevant to your app only you can do:
adb shell dumpsys activity package <your.package.name>
Use the command below can show tasks and activity backstack
adb shell dumpsys activity activities | sed -En -e '/Running activities/,/Run #0/p'
And result looks like this:
Running activities (most recent first):
TaskRecord{29b17859 #1134 A=com.google.android.dialer U=0 sz=1}
Run #0: ActivityRecord{180fd6be u0 com.google.android.dialer/.extensions.GoogleDialtactsActivity t1134}
Running activities (most recent first):
TaskRecord{7764a61 #1054 A=com.google.android.googlequicksearchbox U=0 sz=1}
Run #1: ActivityRecord{2900994b u0 com.google.android.googlequicksearchbox/com.google.android.launcher.GEL t1054}
TaskRecord{4aa804c #1129 A=com.android.systemui U=0 sz=1}
Run #0: ActivityRecord{1816140b u0 com.android.systemui/.recents.RecentsActivity t1129}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With