I’m starting my alarm in the following way:
protected void onHandleIntent(Intent intent) {
Log.v("alarm", "onHandleIntent");
int alarmType = AlarmManager.ELAPSED_REALTIME_WAKEUP;
long interval = AlarmManager.INTERVAL_HALF_HOUR;
long timeToRefresh = SystemClock.elapsedRealtime() + interval;
alarmManager.setInexactRepeating(alarmType, timeToRefresh, interval, alarmIntent);
updateService();
}
But the alarm isn’t triggered every 30 minutes, but only every 45 minutes. Why? Is the tolerance of setInexactRepeating 15 minutes?
From the docs, “Your alarm’s first trigger will not be before the requested time, but it might not occur for almost a full interval after that time. In addition, while the overall period of the repeating alarm will be as requested, the time between any two successive firings of the alarm may vary. If your application demands very low jitter, use setRepeating(int, long, long, PendingIntent) instead.”
Source: AlarmManager