title: How to cancel alarm from AlarmManager
body: <p>I have met same issue like this . 
  <a href="https://stackoverflow.com/questions/14485368/delete-alarm-from-alarmmanager-using-cancel-android">Delete alarm from AlarmManager using cancel() - Android</a></p>
  
  <p>"
  I'm trying to create and delete an alarm in two different methods which are both called at different moments in the application. logic.</p>
  
  <p>However when I call AlarmManager's cancel() method, the alarm isn't deleted."</p>
  
  <p>In order to set :</p>
  
  <pre><code>            Intent myIntent = new Intent(getApplicationContext(),
                      SessionReceiver.class);
              PendingIntent pendingIntent = PendingIntent.getBroadcast(
                      getApplicationContext(), 1, myIntent, 0);
  
              AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
  
              alarmManager.set(AlarmManager.RTC, now.getTimeInMillis(),
                      pendingIntent);
  </code></pre>
  
  <p>In order to delete : </p>
  
  <pre><code>    AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
      Intent myIntent = new Intent(getApplicationContext(),
              SessionReceiver.class);
      PendingIntent pendingIntent = PendingIntent.getBroadcast(
              getApplicationContext(), 0, myIntent, PendingIntent.FLAG_UPDATE_CURRENT);
  
      alarmManager.cancel(pendingIntent);
  </code></pre>
  
  <p>But this doesn't remove an alarm registered. 
  Thanks in advance. </p>