Closed axelsimon closed 5 years ago
I'll check to see if Android has a way to get notified of time zone changes when they happen. Otherwise, this is probably not worth the time to fix, since it's a rare occurrence and with the current implementation it should automatically correct itself for tomorrow, anyway.
Looks like it is possible to do this by adding a broadcast receiver that listens for ACTION_TIMEZONE_CHANGED.
What we need to do when receiving ACTION_TIMEZONE_CHANGED
is mostly same as what we're doing on receiving ACTION_BOOT_COMPLETED
except there might be a pair of schedules to cancel. So I'm thinking of taking out filterIsOnPrediction
to some common module to use for different events/lifecycles. Any thoughts or recommendations? Thanks.
Brainstorm: I can think of a couple options (ordered from pretty to quick and dirty) —
filterIsOnPrediction
into a common module like you suggestfilterIsOnPrediction
out of BootReceiver
ACTION_TIMEZONE_CHANGED
and handle it in onReceive
.I'd probably accept any of those, though the last is pretty hacky. If I were doing it myself I'd probably do the middle one, and refactor to the first if it turns out there's other places we want to use filterIsOnPrediction
.
I liked the middle one two. Just created a PR. Thanks!
Hi! When going from one time zone to another one further west (ie, going one hour "back in time") I discovered my Red Moon filter kicked in at 23:15 (new time) which corresponds to 00:15 in my original time zone.
Red Moon is set to enable the filter at 00:15.
I expected the filter to be activated at 00:15 when the phone's clock read 00:15, not 23:15 :)
Red Moon version: 3.3.3 (F-Droid) Android version; 5.1 (cm 12) Xperia z3
Hope this helps!