0

I am making an application in which I have to execute the method at the time set by user. Is there any way to overcome this problem?

Jaydeepsinh Jadeja
  • 391
  • 2
  • 10
  • 20

3 Answers3

1

Define a PendingIntent that will execute the operation then setup Alarm to execute the PendingIntent: http://developer.android.com/reference/android/app/AlarmManager.html

slayton
  • 20,123
  • 10
  • 60
  • 89
1

Maybe this could help you: http://developer.android.com/reference/java/util/TimerTask.html

And others related:

Android timer? How-to?

How to set a timer in android

Community
  • 1
  • 1
Chopin
  • 1,442
  • 17
  • 24
1

The best way to implement this would be to create a Service in your application that invokes an AlarmManager. The AlarmManager is used to trigger an event set in the future and invoking it in a service enables you to run it even when your application is closed. A very fine tutorial of the same can be found here. Although i would suggest you to go through the AlarmManager documentation first.

Anurag Ramdasan
  • 4,189
  • 4
  • 31
  • 53