I'm trying to write a timer where the user will select X minutes.
I have a display and also a service running in case the screen is off.
But the service does not fire at exactly 60 seconds if the user selected 1 minute.
I tested your example using each of these 3 nuances using a time of 1 minute and did not see any difference between the three. All seem to work properly. The first number you see after the timer starts is of course 58 seconds.
The difference in "the more accurate version" is only relevant to Android 6+ and it is also possible that you will not see any difference. It prevents the OS from changing the scheduled time to preserve battery power.
I tested your example using each of these 3 nuances using a time of 1 minute and did not see any difference between the three. All seem to work properly. The first number you see after the timer starts is of course 58 seconds.
The timer on the screen ran just fine but the service that would sound the alarm was inconsistent.
About 10% of the time it would fire on time but the other 90% of the time it was 10, 14, 38 etc seconds late.
Using SetExactAndAllowWhileIdle (targetTime, "alarm") it now fires on time, every time on my LG G4 android 6.0
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.