• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

[shell] Checking whether an app is swapped out?

HippoMan

Member
I'm very familiar with shell programming, but there are Android-specific details that I'm a little hazy on.

I'd like to use "ps" or "pgrep" or some sort of command-line utility to test whether a given app is "swapped out" ... i.e., that's it's running, but not in the foreground.

I know that ps/pgrep will show the pid associated with the app if it's running at all (either foreground or swapped out). However, is there any data returned by ps or pgrep or any other command-line utility that will indicate the app's foreground/swapped-out state on the device?

To be clear, by "foreground", I mean that it's the app that is currently showing on the screen and interacting with the user. By "swapped out", I mean that the app still running, but a different app is in the foreground, as described.

Thank you for any info.
 
Back
Top Bottom