Have you considered using IntentService?

On Sep 17, 7:29 am, Spidey <spide...@gmail.com> wrote:
> Sorry for double posting, but I haven't confirmed if the first message
> was received. I'm sending this one through google groups website, hope
> this reach the group.
>
> =========================
> Ok, so in a project I'm in, we are implementing a service to handle
> connection changes and downloads. The service handles a queue of
> AsyncTasks, each representing a "download task". This way, we can
> cancel/pause tasks when connection drops, and also restore them when
> connection is reestablished. Since the threads AsyncTasks are run are
> not deterministic, how many ATs should I execute() at the same time?
>
> I've read that I shouldn't reuse tasks. How can I achieve this pause->resume 
> functionality then? Should I tell the thread to sleep? Should
>
> I make a no-op while if connection is down? I was trusting the
> cancel(true) method, which I've read is not reliable either.
>
> My main DownloadTask is a subclass of AsyncTask that returns a new
> AsyncTask to be called when the connection is restored. Is that a good
> solution?

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

Reply via email to