Reputation: 225
I use an alarm manager to create repeating alarms (at a specific time) and exact alarms (at a time that changes from day to day).
The problem occurs when there's a DST start or finish:
I understood that the value in milliseconds that I use in the alarm methods is in UTC, so how can I deal with these changes (in repeating and in exact alarms)?
I created a BroadcastReceiver, but I don't think it fires all the time, and I didn't see it fire for the DST change.
Here's the receiver:
<receiver
android:name=".TimeChangeReceiver" android:enabled="true" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.TIME_SET" />
<action android:name="android.intent.action.DATE_CHANGED" />
<action android:name="android.intent.action.TIMEZONE_CHANGED" />
</intent-filter>
</receiver>
public class TimeChangeReceiver extends BroadcastReceiver {
@Override
public void onReceive(final Context context, Intent intent) {
setAllAlarms(context);
}
}
Upvotes: 2
Views: 43