0

I've been building medium sized information systems for a year now, using Android as one of the client-side, but I have never used a Service before. To request data from the server, I always fire a request using AsyncTask. When the user enter the corresponding Activity.

A diagram might be represented by the following:

                    -> fires -> AsyncTask -> request from network and insert into local -> refresh view
Activity#onCreate() 
                    -> query local database -> refresh view

Since AsyncTask executes on a background thread, there are no bug issues or similar.

Can I get a REAL explanation on Services vs AsyncTask on network operations?

Christopher Francisco
  • 15,672
  • 28
  • 94
  • 206

1 Answers1

1

if you want a long running background task such as connecting to a socket and want it to live even if you start another app you need service, and if you just download, get, etc from a server(except downloading a large file) for a short period of time then you should use AsyncTask..

well in your diagram it is a short running background task where AsyncTask is best fitted for it.

Rod_Algonquin
  • 26,074
  • 6
  • 52
  • 63