react-native-background-timer
react-native-background-timer copied to clipboard
Interval time changes periodically
I'm testing this module by setting up a timer to log the time every 10 minutes and running it for extended periods. When I check the times logged, it is sometimes every 10 minutes, but sometimes switches to a new, longer interval. It is weirdly consistent when it switches, the new interval lasting potentially for hours and being stable to within 10 or so seconds. I've seen intervals around 14, 16, or even 21 minutes, so it isn't just a clean multiple of the original.
Has anyone else experienced this instability or know why it is?
I've experienced it as well (on Android). Very odd when it occurs, as like you said, the times can vary greatly.
I'm guessing it's a limitation of the underlying timer/alarm/callback system used -- perhaps when cpu usage is too high or something, it slows down the timer triggerings. (though the variance seems extreme, if this is the explanation)
I have the same issue. both ios and android,
when running a long timeout you won't have clock drift accounted for.
looking at the project source at the time of this comment the interval function also doesn't account for clock drift.
see: http://www.ntp.org/ntpfaq/NTP-s-sw-clocks-quality.htm
In my case, when the android phone is on, everything works great, both in foreground and background. But when the phone is locked (screen off), the interval changes a lot, but still working. This difference is so long that a need to find out something to fix that.
any update?
@ocetnik , any update about that?