title: Can my AlarmManager fire the first alarm, when the set time is reached, not after the first repeating?
body: <p>For my app I would like to fire an alarm at midnight and periodically every next midnight to reset some variables. I tried the alarm manager to achieve that. Is it possible, that the alarm fires at the first time it reaches midnight and not just at the following midnights?
  My actual code is working, but not for I want to achieve. I set the time now and repeating time to 60 seconds for testing. </p>
  
  <p>In my Log outputs I get e.g.:</p>
  
  <ul>
  <li>20.01.2020_14:15:00 <strong>Here I want an ALARM</strong></li>
  <li>20.01.2020_14:16:00: ALARM</li>
  <li>20.01.2020_14:17:00: ALARM</li>
  </ul>
  
  <p>So is it possible to have an Alarm fired, directly at the first time, when it reaches the set time? Or does someone have a workaround or any tips or hints how I can achieve that?</p>
  
  <p>My function to set the alarm</p>
  
  <pre class="lang-java prettyprint-override"><code>public void midnightAlarm() {
   AlarmManager alarmMgr;
          PendingIntent alarmIntent;
  
          alarmMgr = (AlarmManager)this.getSystemService(Context.ALARM_SERVICE);
          Intent intent = new Intent(this, MidnightAlarmReceiver.class);
          alarmIntent = PendingIntent.getBroadcast(this, 0, intent, 0);
  
  
          Calendar calendar = Calendar.getInstance();
          calendar.setTimeInMillis(System.currentTimeMillis());
          calendar.set(Calendar.HOUR_OF_DAY, 15);
          calendar.set(Calendar.MINUTE, 15);
  
  
          alarmMgr.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),
                  1000 * 60 , alarmIntent);
  
      }
  </code></pre>
  
  <p>my Reciever class:</p>
  
  <pre class="lang-java prettyprint-override"><code>public class MidnightAlarmReceiver extends BroadcastReceiver {
  
      @Override
      public void onReceive(Context context, Intent intent) {
  
             writeToFile("ALARM");
             //reset my Variables
  
      }
  }
  
  </code></pre>