0

I am developing AppWidget which should call web service on some interval using BroadcastReceiver. What is the best practice for fetching data in AppWidget on particular interval? Is it better to use AsyncTask or to use Service?

vikifor
  • 3,426
  • 4
  • 45
  • 75
  • Your broadcastreceiver is run every interval, and from there you want to trigger the data fetching? – Tim Jul 20 '16 at 07:45
  • My broadcast receiver run on 30min and on every 30min I fetch data from web service – vikifor Jul 20 '16 at 07:47
  • Is it a possible duplicate, but I would like to know what is best practice for AppWidgets if I like to update AppWidget every 30min without user interaction – vikifor Jul 20 '16 at 07:53
  • You'll want to use a `Service`, and do your network stuff on a separate `Thread` therein. An `IntentService` might be a good option, depending on your needs, since it has its own worker `Thread` "built-in". – Mike M. Jul 20 '16 at 11:55

0 Answers0