I'm trying to figure it out how to do this, I'd like to create a timer from data that comes by server like : 3600 <-- this comes from server, so I'd like to create a timer with this time and have a TextView that is updating it every 1 second and once the timer is done create a dialog, this is not necessary I know how to do it, but I'd like to do like if user put the app in background timer keeps running.
What I thought is to create a BroadcastService
and update from there the TextView
and if the app goes on background in onPause()
I should do something to keep running the timer, and also thought about if timer is done, add it to a SharedPreferences so I can know if the timer is finished or not (if the user had the app in background).
How can I achieve this?