I want to create a countdown timer that works even when the app is not open.
Only video’s in english are allowed in the community. Besides that post a screenshot of your blocks and describe what is the problem in order to get help. Just by watching a tutorial video we can’t help
You could use search
Do you mean if the app is closed or the app is not visible (but not closed / in idle mode)? If the latter, then you need a
Foreground service to prevent
Doze mode (on devices with Android ≥ 6, API 23).
But , we think foreground service is not needed for this.
You can design blocks to compare the timer started time and final time into tinydb also you can adjust blocks based on it.
It is needed (otherwise the timer will stop after a while if the app is in the background).
Probably that was my thought only. I have answered from my experience.
I have designed in such a way, once hit start button, I will get current time from web as a millis as well store the final time as a millis into tinydb.
And timer will start to see the difference between started millis +1000 & final millis (using your extension) and will display the remaining H, M,S if day is needed.
If app is closed and open again, app will take inline online into millis and do the same thing. So it will start from the reaming timer left but not from where I left previously
The only things is My logic will work with two condition
- Network needed
- App should not reinstall.
The purpose of a countdown timer is to e.g. plays a beep when the time is up. And this even if the app is not visible (i.e. in the background). However, this does not work on all devices with Android > 5, because (especially on Samsung devices) the
Doze mode is activated and the timer stops in the background.
Foreground service is required.