title: How to stop Android AlarmManager when there is a manual system time change?
body: <p>Here is an extended example of the problem. It is 1:30AM. Alarm is set for later today, at 10AM. I change my phones time to 1159PM yesterday. Alarm Manager instantly triggers, at the wrong time.</p>
  
  <p>How do I stop the AlarmManager from ringing if the time is in the past?</p>
  
  <p>If however, I change the time forward, nothing happens. </p>
  
  <p>I do not want this to happen with my app, as it does not happen with other Alarm apps. Is there a way to make sure that the Alarm manager only rings at the exact minute it is set (if not skip it)?</p>
  
  <p>Here is my Alarm Manager code.</p>
  
  <pre><code>        Calendar alarmCal = closestAlarm.toCalendar();
  
          Intent alarmIntent = new Intent(this, ActiveAlarmService.class);
          alarmIntent.putExtra("alarm", closest);
  
          pendingAlarm = PendingIntent.getService(AlarmService.this, 0, alarmIntent, PendingIntent.FLAG_CANCEL_CURRENT);
  
          alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
          alarmManager.set(AlarmManager.RTC_WAKEUP, alarmCal.getTimeInMillis(), pendingAlarm);
  </code></pre>
  
  <p>I have tried using a BroadcasetReceiver to catch the Time/Date change events, but there is too much lag between the broadcast, and the AlarmManager firing because it is set in the past.</p>