title: [Android][Parse] Push notifications - intercept notification inside the app when being in some activity and execute some method
body: <p>I have implemented Parse Push Notifications service on my Android application, and added these lines to <code>AndroidManifest.xml</code>:</p>
  
  <pre><code>&lt;service android:name="com.parse.PushService" /&gt;
      &lt;receiver android:name="com.parse.ParseBroadcastReceiver"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.BOOT_COMPLETED" /&gt;
              &lt;action android:name="android.intent.action.USER_PRESENT" /&gt;
          &lt;/intent-filter&gt;
      &lt;/receiver&gt;
      &lt;receiver android:name="com.parse.ParsePushBroadcastReceiver"
          android:exported="false"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="com.parse.push.intent.RECEIVE" /&gt;
              &lt;action android:name="com.parse.push.intent.DELETE" /&gt;
              &lt;action android:name="com.parse.push.intent.OPEN" /&gt;
          &lt;/intent-filter&gt;
      &lt;/receiver&gt;
      &lt;receiver android:name="com.parse.GcmBroadcastReceiver"
          android:permission="com.google.android.c2dm.permission.SEND"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="com.google.android.c2dm.intent.RECEIVE" /&gt;
              &lt;action android:name="com.google.android.c2dm.intent.REGISTRATION" /&gt;
  
              &lt;category android:name="my.package.name" /&gt;
          &lt;/intent-filter&gt;
      &lt;/receiver&gt;
  </code></pre>
  
  <p>Push notifications work well, and when the users starts the app by pressing the push notification alert, the adequate activity launches. The push notifications I send are of the following form:</p>
  
  <pre><code>alert: "message to show",
  type: "type_1",
  data: "some_data"
  </code></pre>
  
  <p>Now, the thing I could not figure out how to do, is that, only when being on a concrete activity (e.g. <code>MyActivity</code>), i want to "intercept" push notifications having some value for the type tag (e.g. those being "type_1") and execute a method (e.g. <code>refreshView</code>) on that activity to launch an async task to retrieve data from a server and refresh some visual elements according to it. If the user is in another activity (not <code>MyActivity</code>), the push notification should be received as normal, without being intercepted.</p>
  
  <p>I tried to implement a broadcast receiver but did not succeed. How can I achieve this?</p>
  
  <p>Thank you.</p>