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?

Mr.T
  • 72
  • 6
  • There have been multiple questions about this already, e.g. [this](https://stackoverflow.com/questions/30619349/android-5-1-1-and-above-getrunningappprocesses-returns-my-application-packag) and [this](https://stackoverflow.com/questions/43507699/getrunningappprocesses-doesnt-work-in-api-22-and-above). As for why Google haven't updated the documentation to reflect this - who knows. – Michael Oct 19 '21 at 09:20

0 Answers0