Because std::time::Instant is implemented using libc::clock_gettime(CLOCK_MONOTONIC) and this time does not advance on Android while the app is in "doze" state, the timer may be effectively paused on Android: https://users.rust-lang.org/t/std-now-with-android/41774
One way to fix this is to use SystemTime instead and handle time occasionally going backwards properly. Another is to lift this issue to the standard library so it uses Android-specific ioctl on /dev/alarm as described here: https://users.rust-lang.org/t/std-now-with-android/41774/2
Because
std::time::Instantis implemented usinglibc::clock_gettime(CLOCK_MONOTONIC)and this time does not advance on Android while the app is in "doze" state, the timer may be effectively paused on Android: https://users.rust-lang.org/t/std-now-with-android/41774One way to fix this is to use
SystemTimeinstead and handle time occasionally going backwards properly. Another is to lift this issue to the standard library so it uses Android-specificioctlon/dev/alarmas described here: https://users.rust-lang.org/t/std-now-with-android/41774/2