0

I am planning to build an application which gets some data from a public API and then binds the data to controls on my Activity. For this task, I could utilize AsyncTask which will allow the API call to run on a separate thread than the UI and then update the UI once the data is ready. Alternatively, I could use a SyncAdapter which has some added benefits, including periodic syncing. At this moment, I don't have a need to do any periodic syncs as I will just be making the calls when the application is running. Do you think that in this case, there is still a case for using SyncAdapter over AsyncTask?

Jr2342342
  • 15
  • 3
  • 1
    You can put your AsyncTask inside the onPerformSync, and request sync. But I advise you to use nice libraries as Volley or Retrofit, they are much easier and faster than AsyncTask. – Anton Shkurenko Jul 10 '15 at 23:54
  • If I'm not going to do periodic syncing, does it not make sense to use SyncAdapter? – Jr2342342 Jul 11 '15 at 02:30
  • SyncAdapter just provides you callbacks when system wants to sync. Sync mechanism you have to write on your own. – Anton Shkurenko Jul 11 '15 at 13:32

0 Answers0