title: Alarmmanager unexpcted behavior
body: <pre><code>    GregorianCalendar cal = new GregorianCalendar();
      cal.set(GregorianCalendar.HOUR_OF_DAY, 10);
      cal.set(GregorianCalendar.MINUTE, 12);
      cal.set(GregorianCalendar.SECOND, 0);
      cal.set(GregorianCalendar.MILLISECOND, 0);
      if(cal.before(new GregorianCalendar())){
          cal.add(GregorianCalendar.DAY_OF_MONTH, 1);
      }       
  
      myalarm = (AlarmManager)getSystemService(ALARM_SERVICE);
  
      Intent mainIntent = new Intent(this, myReceiver.class);         
      pIntent = PendingIntent.getBroadcast(this, 0, mainIntent, 0);
  
      myalarm.setRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), 1000*60*60*24, pIntent);
  </code></pre>
  
  <p>This is the code for set an alarm. myReceiver is an extended BroadcastReceiver start a Service that will fires a notification... daily (as you can see from the alarm settings).</p>
  
  <p>I'm going <strong>mad</strong> because:</p>
  
  <p>1) When I start my application and the alarm is expired IF I swipe my app out of the recent apps list nothing strange happens. In the DDMS panel on the Devices tab in the emulator process list my app disappear. <strong>&lt;---- That's what I except should happens always</strong>.</p>
  
  <p>BUT....</p>
  
  <p>2) When I start my application and the alarm <strong>IS NOT expired yet</strong>, so the notification has not been sent yet and I wait UNTIL the alarm goes off and I receive the notification </p>
  
  <p>THEN....</p>
  
  <p>when I swipe my app out of the recent apps list after a period, between 6 and 30 seconds, the notification appears AGAIN and in the DDMS panel on the Devices Tab in the Emulator process list my app appears again. If I tap on it the main activity of my app starts. </p>
  
  <p>I can reproduce this behavior forever, until... </p>
  
  <p>3) I swipe out the notification without tap on it. At this point no more notifications are sent BUT in the DDMS panel on the Devices Tab in the Emulator process list my app is STILL present because the swipe out of the notification don't kill the app BUT in the recent apps list my application isn't present anymore.</p>
  
  <p><strong>WHY???? What's wrong?</strong> </p>
  
  <p>Additional info:
  playing with Log I've seen that the onReceive method in  my BroadcastReceiver class is called even when the application is not present anymore in the recent apps list.</p>