title: Android: Unable to cancel repeating alarm
body: <p>I am creating a repeating alarm. This works fine using the following code:</p>
  
  <pre><code>Intent intent = new Intent(this.ctx, AlarmReceiver.class);
  intent.setAction("" + notificationId);
  intent.putExtra(AlarmReceiver.TITLE, alarmTitle);
  intent.putExtra(AlarmReceiver.SUBTITLE, alarmSubTitle);
  intent.putExtra(AlarmReceiver.TICKER_TEXT, alarmTicker);
  intent.putExtra(AlarmReceiver.NOTIFICATION_ID, notificationId);
  
   PendingIntent sender = PendingIntent.getBroadcast(this.ctx, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
   AlarmManager am = getAlarmManager();
   am.setRepeating(AlarmManager.RTC_WAKEUP, triggerTime, 60000, sender);
  </code></pre>
  
  <p>Now I want to cancel an existing notification message (which pops up every minute for testing purposes), I invoke the following code, passing it an identical notificationId:</p>
  
  <pre><code>Intent intent = new Intent(this.ctx, AlarmReceiver.class);
  intent.setAction("" + notificationId);
  PendingIntent pi = PendingIntent.getService(this.ctx, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
  
       AlarmManager am = getAlarmManager();
       try {
            am.cancel(pi);
  
           } catch (Exception e) {
         Log.e(PLUGIN_NAME, "AlarmManager update was not canceled. " + e.toString());
  }
  </code></pre>
  
  <p>I see that <code>pi != null</code>, however the notification keeps coming and is not being cancelled. Both code snippets reside in the same class.</p>
  
  <p>Basically I have two questions:
   - How can I cancel a single alarm using its unique ID?
   - How can I cancel all alarms, regardless of the ID?</p>
  
  <p>UPDATE: I found that posting my issue here helps to get my mind straight. Changing the cancel code from:</p>
  
  <p><code>PendingIntent sender = PendingIntent.getService( ... )</code></p>
  
  <p>To:</p>
  
  <p><code>PendingIntent sender = PendingIntent.getBroadcast( ... )</code></p>
  
  <p>Helps to solve question 1. However the code to cancel all events, still does not work:</p>
  
  <pre><code>Intent intent = new Intent(this.ctx, AlarmReceiver.class);
  PendingIntent pi = PendingIntent.getBroadcast(this.ctx, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
  
  AlarmManager am = getAlarmManager();
  am.cancel(pi);
  </code></pre>