title: AlarmManager can't cancel an alarm
body: <p>Let's see if someone found this problem and can help me to solve the mistery. I have the following situation. The app is a simple to-do list:</p>
  
  <pre><code>public class NewToDo extends Activity {
  
      private PendingIntent pendingIntent; 
      private AlarmManager manager;
    ...
  </code></pre>
  
  <p>When the user creates a to-do with a notification, I create it in one of the methods of this class like this:</p>
  
  <pre><code>  int interval = 30000;
    Intent alarmIntent = new Intent(this, AlarmReceiver.class);
    /*Let's let the putExtras apart, as documentation says they're not considered when comparing intents, but I add some of them*/
    manager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
    pendingIntent = PendingIntent.getBroadcast(getBaseContext(), _id, alarmIntent, alarmIntent.FILL_IN_DATA);
    /*Printing _id we see 3, for instance, but is a unique identifier to associate the notification with this to-do item*/
    /*I use the flag alarmIntent.FILL_IN_DATA because I want to send extras to create a custom notification*/                  
    manager.setInexactRepeating(AlarmManager.RTC_WAKEUP,
                  System.currentTimeMillis() + interval, interval,
                  pendingIntent);
  </code></pre>
  
  <p>I quit from the app (but no difference if I don't quit).Then the notification arrives correctly each 30 seconds, and selecting it the app launchs on the detailed view of the item. An actionbar button allows editting it, calling again the same class, NewToDo. 
  While editting I can cancel the notifications associated with the to-do, and  my code makes that like this -in the NewToDo class-:</p>
  
  <pre><code>  AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
    Intent i = new Intent(this, AlarmReceiver.class); //creating a matching Intent
  
    Log.v(getString(R.string.app_name), "_id: " + _id);  //the 3 aforementioned
  
    PendingIntent displayIntent = PendingIntent.getActivity(getBaseContext(), _id, i, alarmIntent.FILL_IN_DATA);
    alarmManager.cancel(displayIntent);
  </code></pre>
  
  <p>But the notifications keeps appearing each 30 seconds, so they're not cancelled.    </p>
  
  <p>I saw the following suggestion in another post:</p>
  
  <blockquote>
    <p>"Intent intentYouWantToCancel = new Intent(this, AlarmReceive.class);
    intentYouWantToCancel.setAction("aRelevantString");</p>
    
    <p>when you set the alarmmanager as well as when you want to delete it. " </p>
  </blockquote>
  
  <p>So I put in both intents as 'aRelevantString' a cast to String of the unique identifier. But same problem.</p>
  
  <p>Also changed the getBaseContext() for <em>this</em>, just in case, but no difference. </p>
  
  <p>No errors, just the notifications keep repeating ignoring my cancel. Any idea? </p>
  
  <p>PS: I restart the AVD each time I run it. I realised that the way I was using the print of the filterEquals had no sense at all (too many hours with this), but that doesn't affect the rest of the question.</p>