title: Cancel notification not working
body: <p>I want to cancel/delete the notification after I click the addAction.</p>
  
  <p>However it's not working. The notification is still there after the click. 
  I'm pretty sure this worked in an other project.</p>
  
  <p>Can anyone see a stupid error I made, why its not working? </p>
  
  <p><strong>Actual code:</strong></p>
  
  <pre><code>    public class AlarmReceiver extends BroadcastReceiver {
  
  @Override
  public void onReceive(Context context, Intent arg1) {
  
      showNotification(context);
  
  }
  
  private void showNotification(Context context){
  
  
      String onderwerp = ("Medicatietijd");
      String name = ("Het is tijd om je medicitie in te nemen.");
  
      // Geluid notificatie
      Uri soundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
  
      // Notificatie trigger
      PendingIntent contentIntent = PendingIntent.getActivity(context, 0,
              new Intent(context, Test.class), 0);
  
      // De notificatie
      Notification mNotification = new Notification.Builder(context)
  
          .setContentTitle(onderwerp)
          .setContentText(name)
          .setSmallIcon(R.drawable.ninja)
          .setSound(soundUri)
          .addAction(R.drawable.ja, "Ja, ik heb ze ingenomen.", contentIntent)
          .setAutoCancel(true)
  
          .build();
  
      NotificationManager notificationManager 
         = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
  
      mNotification.vibrate = new long[]{100, 200, 100, 500}; 
      mNotification.flags |= Notification.FLAG_AUTO_CANCEL;       
  
      notificationManager.notify(0, mNotification);
  
  }
  </code></pre>
  
  <p><strong>Solution:</strong>
  In test activity OnCreate added this:</p>
  
  <pre><code>   NotificationManager notificationManager 
         = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
  
      notificationManager.cancel(0);
  </code></pre>