Is there a way to be aware of the execution of a 3rd party app?
<p>Basically, I want to find out when another app starts, so I can adjust my app in a particular way. For example, if the user starts the GMail app, my service can detect that and react.</p>

<p>My current idea is to check 'topActivity' for each element in <code>getRunningTasks()</code> from the <code>ActivityManager</code> class. But that sounds quite expensive, since it needs to be constantly checking in the background (and I'm quite fussy about the CPU usage of my app).</p>

<p>If anyone knows a better way, I'd love to hear it!</p>
