Search code examples
androidservicetimerrunnablealarm

How can I perform a task after user defined amount of minutes?


I am making some sort of timer, which uses a Service to define a Runnable which is being ran after the user defined amount of minutes. The problem is that when the user defined amount of minutes is about (or higher than) 120 minutes, it seems the system forgets about the Runnable, and doesn't perform the tasks in there.

My question is: Is there a better way to schedule tasks to be ran after a specified amount of time?

Thanks in advance!


Solution

  • use alarm manager to trigger the event after some time refer here http://www.learn-android-easily.com/2013/06/scheduling-task-using-alarm-manager.html