Actually, a service should serve your needs quite well.

If you need to keep the device awake while there are downloads in progress, use WakefulIntentService (by Mark Murphy) or acquire a WakeLock.

If you would like several concurrent downloads, extend from Service yourself and create more than one worker thread.

Give your service a time limit during which it continues to run, before calling stopSelf() to shut down, and you'll be able to reuse the http client object from a previous download ( although the benefit of this is not obvious to me ).

-- Kostya

15.12.2010 15:28, flipside пишет:
I'm developing an application in which the user will be firing off
http gets sporadically. Perhaps a burst of four or five, then a pause
for maybe a few seconds or or tens of seconds or a few minutes, and
then another burst. I'm familiar with HTTPClient in non-Android apps,
and it seems appropriate to use AndroidHTTPClient in this scenario.
I'm trying to determine the most efficient way to put it into a thread
and use it.

The transient thread-creation methods such as AsynchTask and
IntentService don't seem appropriate, because the AndroidHTTPClient
will be lost when the task completes. Perhaps I should put into a
Service. I guess that what I'm trying to do is a pretty common
requirement and I was wondering if anyone had any pointers. I'm
thinking particularly about how best to cater for life-cycle events
and configuration changes that might affect ongoing requests. I'm
expecting most of the requests to be short-lived, but of course there
is no guarantee.



--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to