title: Get PHONE_STATE event only when app is already running
body: <p>I have an app for which I've added some functionality for when a call is coming in (phone ringing or answered). I did so by creating a <code>BroadcastReceiver</code> like this:</p>
  
  <pre><code> &lt;receiver android:name="mypackage.PhoneReceiver" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.PHONE_STATE" &gt;
                  &lt;/action&gt;
  
              &lt;/intent-filter&gt;
          &lt;/receiver&gt;
  </code></pre>
  
  <p>It is all working well but the problem is that it gets called even when my app isn't running, which makes sense but this triggers all sorts of other things on my app. </p>
  
  <p>So the question is, can I have that <code>BroadcastReceiver</code> triggered only if my app (or a service I have) is running? or have my <code>Application.onCreate()</code> somehow know it is being created for the <code>BroadcastReceiver</code> and skip everything else it usually does?</p>
  
  <p>Thanks. </p>