Why does ActivityManager.runningAppProcesses returns current running app, only?
Asked Answered
H

0

2

On my AndroidTV Emulator I have:

val am = this.getSystemService(ACTIVITY_SERVICE) as ActivityManager
am.runningAppProcesses?.forEach {
    Logger.debug("XXX", "Running ${it.uid} , ${it.processName}, ${it.pid}")
}

I also start other 3rd party apps, but I dont kill them.

The Google Docs say:

Returns a list of application processes that are running on the device.

for ActivityManager.runningAppProcesses.

When executing this code from Android Studio, runningAppProcesses list has always size 1 and its the current app triggered from Android Studio?

I was expecting, that these 3rd party apps, I launched earlier are listed there as well?

What is meant by "application processes that are running on the device"? Are backgroundprocesses not included there?

How can I do so?

Hyperactive answered 19/10, 2021 at 8:28 Comment(1)
There have been multiple questions about this already, e.g. this and this. As for why Google haven't updated the documentation to reflect this - who knows.Ustulation

© 2022 - 2024 — McMap. All rights reserved.