title: Can't swipe-delete a notification from service
body: <p>I have a service which downloads data, runs in a separate process (so that it doesn't die/restart when the app is closed) and shows a notification with it's progress. I want to be able to stop the service if the user swipe-deletes the notification, but have so far been unable to do it. Relevant code below:</p>
  
  <p>DatabaseDownloadService.java</p>
  
  <pre><code>public class DatabaseDownloadService extends Service
  {
      private final static int NOTIFICATION_ID = 1337;
      private final static String NOTIFICATION_DISMISSAL_TAG = "my_notification_dismissal_tag";
      private NotificationManager mNotificationManager;
  
      @Override
      public void onCreate()
      {
          super.onCreate();
  
          mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
          Notification notification = getNotification("Downloading database...");
          startForeground(NOTIFICATION_ID, notification);
  
          startDownloadingStuff();
      }
  
      private Notification getNotification(String text)
      {
          NotificationDismissedReceiver receiver = new NotificationDismissedReceiver();
          registerReceiver(receiver, new IntentFilter(NOTIFICATION_DISMISSAL_TAG));
  
          Intent intent = new Intent(this, NotificationDismissedReceiver.class);
          PendingIntent deleteIntent = PendingIntent.getBroadcast(this, NOTIFICATION_ID, intent, 0);
  
          return new NotificationCompat.Builder(this)
                  .setSmallIcon(R.mipmap.ic_launcher)
                  .setContentTitle("My Awesome App")
                  .setContentText(text)
                  .setDeleteIntent(deleteIntent)
                  .build();
      }
  
      public class NotificationDismissedReceiver extends BroadcastReceiver
      {
          @Override
          public void onReceive(Context context, Intent intent)
          {
              int notificationId = intent.getExtras().getInt(NOTIFICATION_DISMISSAL_TAG);
              Toast.makeText(context, "Download cancelled", Toast.LENGTH_SHORT).show();
  
              // Do more logic stuff here once this works...
          }
      }
  }
  </code></pre>
  
  <p>AndroidManifest.xml</p>
  
  <pre><code>&lt;application
      ... properties and activities go here...&gt;
  
      &lt;service
          android:name=".DatabaseDownloadService"
          android:process=":dds_process"
          android:enabled="true"/&gt;
  
      &lt;receiver
          android:name="com.myapp.DatabaseDownloadService$NotificationDismissedReceiver"
          android:exported="false"/&gt;
  
  &lt;/application&gt;
  </code></pre>
  
  <p>As far as I can tell, the .setDeleteIntent() should make the notification swipe-deletable, which should then send a broadcast, which should then be caught by my NotificationDismissedReceiver. However, as it stands, I can't even swipe-delete the notification, and I never see the "Download cancelled" Toast...</p>