Determining the current foreground application from a background task or service
<p>I wish to have one application that runs in the background, which knows when any of the built-in applications (messaging, contacts, etc) is running.</p>

<p>So my questions are:</p>

<ol>
<li><p>How I should run my application in the background.</p></li>
<li><p>How my background application can know what the application currently running in the foreground is.</p></li>
</ol>

<p>Responses from folks with experience would be greatly appreciated.</p>
