title: BroadcastReceiver is never called by pending intent in setDeleteIntent of Notification
body: <p>Having quite a bit of trouble getting my foreground service to simply dismiss on swipe or by the clear all notifications button. I know there are several questions like this, but I have read them and will list some of what I've already tried. I tried <a href="https://stackoverflow.com/questions/12872204/how-to-cancel-a-foreground-service-from-using-the-notification-swipe-dismiss-o">this</a> method, where you pass a simple intent with an extra into a pending intent, then add that pending intent to setDeleteIntent(). That didn't work, it never gets called. </p>
  
  <p>I also tried <a href="https://stackoverflow.com/questions/14671453/catch-on-swipe-to-dismiss-event?noredirect=1&amp;lq=1">this (second highest answer, "fully fleshed out" version)</a>, with the same results. Which ties in to the "answer" of <a href="https://stackoverflow.com/questions/44940632/pending-broadcastreceiver-does-not-start-using-setdeleteintnet">this</a> question as well. With how many apps have notifications that are dismissible with a swipe or clear all button, I must be missing something very obvious and I can't figure out what.</p>
  
  <p>What my current code looks like (all of this inside of my service class).</p>
  
  <p>BroadcastReceiver class</p>
  
  <pre><code>public class NotificationDismissedReceiver extends BroadcastReceiver {
      @Override
      public void onReceive(Context context, Intent intent) {
          // this is never called
          stopSelf();
      }
  }
  
  // in the manifest for that BroadcastReceiver, have also tried it with these values false
  android:exported="true"
  android:enabled="true"
  </code></pre>
  
  <p>Pending intent</p>
  
  <pre><code>private PendingIntent createOnDismissedIntent(Context context, int notificationId) {
      Intent intent = new Intent(context.getApplicationContext(), NotificationDismissedReceiver.class);
  
      PendingIntent pendingIntent =
              PendingIntent.getBroadcast(context.getApplicationContext(),
                      notificationId, intent, 0);
      return pendingIntent;
  }
  </code></pre>
  
  <p>In the notification builder (101 is what I startForeground with)</p>
  
  <pre><code>.setDeleteIntent(createOnDismissedIntent(this, 101))
  </code></pre>
  
  <p><strong>Edit:</strong></p>
  
  <p>Separate file receiver used instead of the inner class version.</p>
  
  <pre><code>public class NotificationDismissedReceiver extends BroadcastReceiver {
  @Override
  public void onReceive(Context context, Intent intent) {
      int notificationId = intent.getExtras().getInt("notificationId");
      /* Your code to handle the event here */
      if(notificationId == 101){
          Intent stopIntent = new Intent(context, AssistorServiceClass.class);
          context.stopService(stopIntent);
      }
  }
  }
  </code></pre>
  
  <p><strong>Edit2</strong></p>
  
  <p>To be clear, I'm not trying to stop the foreground notification and keep the service alive. I want them both just gone, as if I called stopSelf within the service class.</p>