Search code examples
androidbackground-application

Is there a way to count applications running in background in Android programmatically?


Some applications in Android show the number of background applications running in the device. Is there any way to find it programmatically ?


Solution

  • Yeah, but you need a scary permission for your app in order to do it (http://developer.android.com/reference/android/Manifest.permission.html#GET_TASKS). Edit: this is scary because it is a permission that most apps shouldn't need, and from a user standpoint makes your app considerably less trustworthy unless you have a very obvious reason for needing it.

    The method to achieve what you are after is: http://developer.android.com/reference/android/app/ActivityManager.html#getRunningTasks(int)