Reputation: 2854
I scheduled an alarm, that triggers every day at the same hour. I set it as repeating alarm (using AlarmManager.setRepeating()
) and it triggers every 24 * 60 * 60 * 1000
milliseconds (24 hours). I don't know if I must control daylight saving time changes, or it's automatic.
I tested this with:
1:59
) (change is from 2 am to 3 am).3:01
.But if I set this alarm that runs every day, for example, 2 days before daylight saving time change... It would run as expected after daylight saving time change? Or do I need to control it?
Upvotes: 1
Views: 1155
Reputation: 704
You need to use TIME_TICK intent also. This intent is fired in each change of time on Android. Also by minors corrections automatically done by network.
Upvotes: 0
Reputation: 8307
you need to add a TIMEZONE_CHANGED receiver and reshedule your alarms (stop and restart)
<receiver android:name="RecevierTimeZoneChange">
<intent-filter>
<action android:name="android.intent.action.TIMEZONE_CHANGED"></action>
</intent-filter>
</receiver>
Upvotes: 1