tags:

views:

75

answers:

2

Hi, should we use android services for network connection? if yes please provide me a sample.

+1  A: 

It depends what kind of network connection you are using. If you just want to fetch some data from the web I would recommend using a AsyncTask. If you are opening a port to a distant server for a longer living connection like a chat application would use you may want to look at a service.

Janusz
A: 

In general you're better of just wraping the communication in an AsyncTask. Then you can easily handle for instance progress updates and canceling of requests etc. Services should be reserved for heavy lifting.

Emil H