Skip to content

Commit

Permalink
Log date/time of the next schedule update alarm.
Browse files Browse the repository at this point in the history
  • Loading branch information
johnjohndoe committed May 7, 2024
1 parent b12f787 commit 630040f
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import info.metadude.android.eventfahrplan.commons.logging.Logging
import info.metadude.android.eventfahrplan.commons.temporal.DateFormatter
import info.metadude.android.eventfahrplan.commons.temporal.Moment
import nerd.tuxmobil.fahrplan.congress.alarms.AlarmReceiver
import nerd.tuxmobil.fahrplan.congress.alarms.AlarmUpdater
Expand Down Expand Up @@ -51,7 +52,9 @@ object FahrplanMisc {

override fun onScheduleUpdateAlarm(interval: Long, nextFetch: Moment) {
val next = nextFetch.minusMilliseconds(now.toMilliseconds()).toMilliseconds()
logging.d(LOG_TAG, "Scheduling update alarm to interval $interval, next in ~$next")
val nextDateTime = DateFormatter.newInstance(useDeviceTimeZone = false)
.getFormattedDateTimeLong(nextFetch.toMilliseconds(), sessionZoneOffset = null)
logging.d(LOG_TAG, "Scheduling update alarm to interval $interval, next in ~$next ms, at $nextDateTime")
// Redesign might be needed as of Android 12 (API level 31)
// See https://developer.android.com/training/scheduling/alarms
alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP, nextFetch.toMilliseconds(), interval, pendingIntent)
Expand Down

0 comments on commit 630040f

Please sign in to comment.