How to get the list of all activities in our application that are running on the device.
For example: pdf generation and email activities included.
I can che
This is the way to get all the running activities in the application -
try {
ActivityInfo[] list = getPackageManager().getPackageInfo(getPackageName(),PackageManager.GET_ACTIVITIES).activities;
for(int i = 0;i< list.length;i++)
{
System.out.println("List of running activities"+list[i].name);
}
}
catch (NameNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
I've found AppLifecycleHandler as documented in this post to be a great solution for knowing what's happening. I use it primarily to just keep count and clean up when the user is done using the app, but you can implement it with an array in which you store all running activities so you can always call in to find out what's running.