how to run the async task at specific time? (I want to run it every 2 mins)
I tried using post delayed but it\'s not working?
tvData.postDelayed
When phone goes to sleep mode, to save battery, and it is quite possible to happen within 2 mins interval, Handler.postDelayed()
may miss scheduled time. For such activities you should use AlarmManager
, get a lock with PowerManager
to prevent going to sleep back while you're running the AsyncTask.
See my post with code sample here
Also you may want to read Scheduling Repeating Alarms