I am trying to build a knowledge based game , in which user plays and win some coins , gems etc.
My problem is that after the game is over i want to start a timer
/service
/handler
(i dont know basically what to say here) of 5 minutes running in background... When the timer is over I Award user his prize.
At present I have used countdown timer and handler with post delayed for that but the problem is that Both countdowntimer
and Handler
fails to run if user removes the app from recent tasks
..the timer is never complete and user never gets his prize. I want to know how can i award the prize after 5 minutes...
A another stackflow user had the similar question How to keep a CountDownTimer running even if the app is closed?. The accepted answer he received https://stackoverflow.com/a/42970754/17072466 . But its 5 year old..i wonder if that will work now due to Oreo+ background process limitations.
Please help me , its above 1 week still i have not resolved it yet.