Yes we know, but elapsed time is handled when the counter is restarted / app resumed.
As @Taifun said, it all depends on what @Nicola_Imperati wants. I am simply showing a method using native blocks (no extensions). One could always keep the screen alive with another clock and a notifier.
Yes, we've known all this for years, and that's precisely the basic requirement for a countdown app, namely that the timer remains active. What would be the point of a countdown app if you couldn't notice the end of the countdown?
I doubt that, unless the device is being charged during the test. Samsung devices, in particular, are always very restrictive when it comes to energy saving. I own several Samsung devices myself.
Also consider that the timer is not "that accurate" for this kind of usage.
On the companion I measured that every 2 minutes it is off by 1 second ( compared to the internal systemtime ), it means 30 seconds every hour
I didn't claim that, only that the timer wouldn't stop while the device is charging. However, I doubt that a one-hour countdown would be successful if the app isn't brought to the foreground several times in between. I have two dozen test devices here, and it doesn't work on any of them with Android ≥ 6.
Of course, the timer can be corrected, at least to some extent, by synchronizing it with the system time. However, this is a bit tricky. So why not use my extension? It doesn't lose a single millisecond, no matter how long the countdown runs.
In the end, you were absolutely right. As long as the count was called every now and then, it would recover... but when I didn't call it for an hour, it remained frozen... so as you say... it's mandatory to activate a foreground service... period!