Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to know how many applications are running in the background in android?

I can run an application in background but I want to know how many applications are running in the background. Like in some mobile while pressing the center button a list of currently running applications are displayed.

Is this is possible in android? If possible then give some code snippets and steps to achieve this.

like image 339
Rajapandian Avatar asked Jun 30 '09 06:06

Rajapandian


1 Answers

The Dev Tools application (installed in emulators) shows a list of running processes by obtaining an instance of ActivityManager:

ActivityManager am = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningAppProcessInfo> l = am.getRunningAppProcesses();
like image 133
Josef Pfleger Avatar answered Oct 01 '22 17:10

Josef Pfleger