title: How to fix alarm notifications issue
body: <p>Android alarm notifications using alarm manager stops after 5,6 days if app not open in this period of time.</p>
  
  <p>I set a single alarm for specific time and when it triggers, i set next alarm. This process work fine for 5 to 6 days but after that alarms suddenly stops irrespective of android versions if app does not open for 5,6 days. </p>
  
  <p>I use below code</p>
  
  <p>public void setalarm()
  {
    AlarmManager alarmManager = (AlarmManager)context.getSystemService(context.ALARM_SERVICE);</p>
  
  <p>PendingIntent pendingIntent = PendingIntent.getBroadcast(context,           AppConstants.ALARM_ID, intent, PendingIntent.FLAG_UPDATE_CURRENT);</p>
  
  <pre><code>if (Build.VERSION.SDK_INT &gt; Build.VERSION_CODES.LOLLIPOP_MR1)
        {
         //lollipop_mr1 is 22, this is only 23 and above                                                                 alarmManager.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, Calendar.getTimeInMillis(), pendingIntent);
  
            }
         else if (Build.VERSION.SDK_INT &gt; Build.VERSION_CODES.JELLY_BEAN_MR2)
         {
            //JB_MR2 is 18, this is only 19 and above.
         alarmManager.setExact(AlarmManager.RTC_WAKEUP, Calendar.getTimeInMillis(),  pendingIntent);
          }
          else
          {
            //available since api1
           alarmManager.set(AlarmManager.RTC_WAKEUP, Calendar.getTimeInMillis(), pendingIntent);
           }
  
       }
  }
  </code></pre>
  
  <p>//This is broadcast Receiver when alarm trigger</p>
  
  <pre><code>public class ReceiverForAlarm extends BroadcastReceiver
  {
            onReceive()
            {
              //AlarmTrigger
              //Next Alarm set() 
            }
  }
  </code></pre>
  
  <p>Above process working fine for 5,6 days. but after this time period, alarms stopped. it should work continuously without interruption.
  Please suggest solution or work around</p>