Android - When to use Service

Posted by Chris on Stack Overflow See other posts from Stack Overflow or by Chris
Published on 2010-05-07T17:42:38Z Indexed on 2010/05/07 17:48 UTC
Read the original article Hit count: 338

Filed under:
|
|
|

This question is related to my previous question: http://stackoverflow.com/questions/2786720/android-service-ping-url

So I have an Android app that on the click of a button, opens up a web page. Now, in the background I want to call another http url for gathering stats.

My question is does this have to be a service? I know a service is for background tasks that run for an indefinite period of time, while the user is busy doing something else. In my case, all I really need is to get the URL in the background, not show it to the user, instead show the web page to the user.

Can I just not write code to get contents of the http url and fire up the activity that displays the web page? Coz all I want is to get the url in the background and be done with it. Or does this have to be done using the Service class?

I am confused.

Thanks Chris

© Stack Overflow or respective owner

Related posts about android

Related posts about service