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.
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.
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
You can get current name package using
You can use this package name to get current active application
A long press of the HOME key brings up a list of recent (not necessarily running) tasks.
ActivityManager
has what you need. Look atgetRunningAppProcesses
orgetRunningTasks
.You can view this information (and much more) by running
dumpsys activity
via 'adb shell'.