Android: Perceptibility of Applications
<p>The current app that I'm developing requires me to know which apps the user is currently interacting with in any way (and there's no malicious intent here). That is, there are always loads of running app processes and services, but only a select few are actually instantiated or monitored by the user. </p>

<p>I only want to deal with the app processes that are running that the user knows are running. For example, it could be the current app in the foreground, and the music they are playing in the background. However, I want to ignore, say, the SetCPU, Maps, and keyboard services that are always running.</p>

<p>Most of this information can be had through a particular application's <code>RunningAppProcessInfo</code> instance, and within that the <code>importance</code> field. For the application in the foreground, the field would be set to <code>IMPORTANCE_FOREGROUND</code>. For my other condition (the music example one), there is a bit of an issue: there exists a <code>IMPORTANCE_PERCEPTIBLE</code> constant which would handle this scenario perfectly, but it's only relevant for API 9 and above (Gingerbread, effectively). After perusing the Android source, it appears that this particular value is set at a very low level in the Android OS, and is thus not something that is easily recreatable.</p>

<p>After that huge wall of text, my question is... how do I work around this? I need to be able to distinguish a music player (just happens to be the only example I can think of) from docile services, but at the same time I can't afford to relegate my app to only those who are running Gingerbread. What's a developer to do?!</p>
