I'm trying to delay the execution of a Runnable
for a long delay (about a couple of hours).
Since the value I have to change affects only the UI, it is not necessary for the runnable to execute when the app gets killed. Using the AlarmManager or a Job will be inefficient because they will reopen the app if it is closed.
The perfect candidate for my use case would be a Handler
, but unfortunately the Runnable
doesn't get executed with such long delays.
I've also tried with Timer
, ScheduledThreadPoolExecutor
and other solutions which use Threads, with no luck.
Have you an idea on how can I achieve what I need?