0

I try to make an asynctask that can regularly get the code of a web page. I can do this one time with doInBackground method but I can not execute several times :/

Can you help me please ?

Thanks

guyom
  • 9
  • 1

3 Answers3

0

As mentioned here: Repeat a task with a time delay? you should use the Handler class :-)

Community
  • 1
  • 1
Lukas Fink
  • 627
  • 6
  • 18
0

Use AlarmManger's setRepeating method to trigger an IntentService periodically.

Simar
  • 600
  • 4
  • 17
0

I got a good example here, http://www.techrepublic.com/blog/software-engineer/use-androids-alarmmanager-to-schedule-an-event/

use

AlarmManager.setRepeating() insted AlarmManager.set()

like

AlarmManager.setRepeating( AlarmManager.RTC_WAKEUP, Calendar.getInstance().getTimeInMillis() , 2500 ,pi );

where 2500 is interval time in Milliseconds

Prashant
  • 1,593
  • 1
  • 17
  • 32