title: How to properly cancel pending alarms
body: <p>I can't seem to find an answer to this, but what is the criteria for passing in a matching <code>PendingIntent</code> to be removed from an alarm? It it based on the just the name like com.blah.package.myclass or do the <code>Extra</code>s matter?</p>
  
  <p>For example, I'm doing something like this and all alarms fire the same intent:</p>
  
  <pre><code>    public void setAlarm(Context context, long nextAlarmMillis) {
          Intent intent = new Intent(context, AlarmReceiver.class);
          intent.putExtra("alarm", this);
          PendingIntent sender = PendingIntent.getBroadcast(context, 1234 /* unused */, intent, PendingIntent.FLAG_UPDATE_CURRENT);
  
          // Get the AlarmManager service
          AlarmManager am = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
          am.cancel(sender);
          am.set(AlarmManager.RTC_WAKEUP, nextAlarmMillis, sender);
      }
  </code></pre>
  
  <p>What happens is that the <code>Alarm</code> class can be altered, etc and passed in as an <code>Extra</code>. I am canceling the previous alarm, but I'm not sure if it's doing anything or if any left over alarms will remain.</p>
  
  <p>Anyone know for sure?</p>