0

I know that a list of running apps can be attained in the following way:

ActivityManager manager = (ActivityManager) getActivity()
    .getSystemService(ACTIVITY_SERVICE);
List<RunningAppProcessInfo> processes = manager.getRunningAppProcesses();

This, however, returns all running processes. My goal is to get the list of running apps that you seen when you long press the Home button (i.e. apps you are interacting with), not background processes, which I believe are on the UI thread but could be incorrect. Is there a way to do this?

OlivierLi
  • 2,798
  • 1
  • 23
  • 30
AggieDev
  • 5,015
  • 9
  • 26
  • 48

2 Answers2

0

I believe that the answer you are looking for resolves within the getRunningTasks() instead of the getRunningAppProcesses() as mentioned in these articles current running apps, task executed by user

Community
  • 1
  • 1
Jay Snayder
  • 4,298
  • 4
  • 27
  • 53
0

Note that each app process has its own UI thread. The "running apps" list you see by long pressing the HOME button is showing you all of the recent apps which have run, but they are all (generally) running in their own process space. Android does not have a single UI thread which is used by all apps.

Larry Schiefer
  • 15,687
  • 2
  • 27
  • 33