title: android Notification doesnt trigger BroadcastReceiver's onReceive
body: <p>Is it possible to have a notification start a broadcast receiver?</p>
  
  <p>I tried this code but it doesnt work.</p>
  
  <p>Notification is created but when I click on it nothing happens.</p>
  
  <p>NOTE: When I change the notificationIntent to point from MyBroadcastReceiver.class to an activity (like MainActivity.class) it works fine. </p>
  
  <p>Notification creation:</p>
  
  <pre><code>    NotificationManager notificationManager = (NotificationManager) context.getSystemService(
          Context.NOTIFICATION_SERVICE);
  
      int notificationIconId = XXXXXX
      Notification notification = new Notification(
          notificationIconId,
          XXXXXX,
          System.currentTimeMillis()
      );
  
      CharSequence contentTitle = XXXXXXX
      CharSequence contentText = XXXXXX
  
      Intent notificationIntent = new Intent(context,MyBroadcastReceiver.class);
      PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
  
      notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
      notificationManager.notify(1,notification);
  </code></pre>
  
  <p>Here is the BroadcastReceiver</p>
  
  <pre><code>public static class MyBroadcastReceiver extends BroadcastReceiver {
  
  @Override
  public void onReceive(Context context, Intent intent) {
     /*
            */
  
   }
  }
  </code></pre>
  
  <p>Inside AndroidManifest.xml</p>
  
  <pre><code>&lt;receiver android:name=".MyBroadcastReceiver" /&gt;
  </code></pre>