title: Android repeating Alarm doesn't trigger at the set interval
body: <p>I have seen many questions like this in SO. but I didn't get the correct answer.
  I want an alarm to trigger at every 2 minutes after I press a button. So I set an alarm to do so and I set the interval to 3 seconds so that I can observe that my code is working. But the alarm doesn't work as I expected. It triggers at different time intervals like after 2 minutes and sometimes even more that that. And the average interval is more than 1 minute. I don't know what is wrong with this code. </p>
  
  <p>This is my code </p>
  
  <pre><code>    Intent alarmIntent = new Intent(MyActivity.this, AlarmReceiver.class);
      pendingIntent = PendingIntent.getBroadcast(MyActivity.this, 0, alarmIntent, 0);
  
      AlarmManager manager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
      int interval = 3000;
  
      manager.setInexactRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(),
              interval, pendingIntent);
      Log.v("xyz", "alarm started");
  </code></pre>
  
  <p>And I tried this also but it gives the same result`</p>
  
  <pre><code>    Intent alarmIntent = new Intent(MyActivity.this, AlarmReceiver.class);
      pendingIntent = PendingIntent.getBroadcast(MyActivity.this, 0, alarmIntent, 0);
  
      AlarmManager manager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
      int interval = 3000;
  
      manager.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime()+2000,
              interval, pendingIntent);
      Log.v("xyz", "alarm started");
  </code></pre>