I\'m struggling with an issue in my app. I\'d like to provide a way to list the history of the previous opened activities.
I think there are two potential solutions
Using ADB commands:
1. adb shell dumpsys activity activities -> displays list of activities in back stack
2. adb shell dumpsys activity process -> displays list process in back stack
3. adb shell dumpsys activity intents -> displays list of pending intents in back stack
4. adb shell dumpsys activity broadcast -> displays list of broadcast in back stack
5. adb shell dumpsys activity services -> displays list of services running in back stack
Using Activity manager:
ActivityManager m = (ActivityManager) ctx.getSystemService( ctx.ACTIVITY_SERVICE );
List runningTaskInfoList = m.getRunningTasks(10);
Iterator itr = runningTaskInfoList.iterator();
while(itr.hasNext()){
RunningTaskInfo runningTaskInfo = (RunningTaskInfo)itr.next();
int id = runningTaskInfo.id;
CharSequence desc= runningTaskInfo.description;
int numOfActivities = runningTaskInfo.numActivities;
String topActivity = runningTaskInfo.topActivity.getShortClassName();
}