How To Check Current Running Applications in Android - Stack Overflow PDF
How To Check Current Running Applications in Android - Stack Overflow PDF
Stack Overflow
log in
24
I want to check current running applications in android programmatically, similar to how it shows 6 applications if we press and hold the HOME button.
I'm mostly interested in the application names.
share
Asked
Jul 19 '10 at 6:33
Rob Hruska
65.2k 21 126 165
Edited
Nov 11 '11 at 12:58
3 Answers
43
Order By
You can use this package name to get current active application
share
Votes
Anoop
16.4k 7 35 63
Answered
Mar 26 '11 at 16:16
Awesome answer. I was looking for this forever! This gives the task that the user is currently doing (program they are currently in). Great! Camille Svigny Jul 13 '12 at 13:07
11
The getRunningTasks method has been truncated in the latest API for Android Lollipop. Do you have any suggestions on an alternative way to do this? prajitdas Nov 11 '14 at
12:59
BTW, on Android 5 you can even get the list of 0 size as a result of getRunningTasks, so get(0) raises the "IndexOutOfBoundsException: Invalid index 0, size is 0". This information
comes from Google Play ANR reporting tool for a published application. Stan Jan 1 '15 at 14:48
show 1 more comment
A long press of the HOME key brings up a list of recent (not necessarily running) tasks.
ActivityManager has what you need. Look at getRunningAppProcesses or getRunningTasks.
You can view this information (and much more) by running dumpsys activity via 'adb shell'.
share
Answered
Jul 19 '10 at 7:56
Damian Helme
301 3 17
Edited
Jul 27 '14 at 20:28
You can check the processName of each element in the list to see if it's the process you're looking for. You can use this code
share
Answered
Apr 27 '11 at 9:11
Spynet
500 1 6 24
Edited
Nov 25 '14 at 10:12
meta chat tour help blog privacy policy legal contact us full site
Download the Stack Exchange Android app
2016 Stack Exchange, Inc