On Aug 15, 2:55 pm, Mark Murphy <[email protected]> wrote:

> By "posts a task", do you mean executes an AsyncTask, or something else?

I postDelayed a Runnable in a Handler.

One should never assume. "To assume makes an ASS of U and ME". I
assumed that a Service would run at a lower priority than the Activity
thread. Putting the Runnable in a thread with a priority one lower
than the Service's thread seems to solve the problem - need more
testing, but I haven't seen the popup yet. I will check out AsyncTask
to see if that's a better solution than creating a thread.

I use a Service primarily for not delaying the UI, and because the
upload needs to complete even when the Activity gets destroyed. I like
the concept of Activities and Services. At first glance, it seems to
be a little complex, but it's really very simple. My service gets
started when the user wants to do an upload, then it keeps running for
some ten minutes, then stops if there's no new uploads.





>
> > I think - but I need to do more testing - that
> > unbinding from the service right after the aidl call solves the
> > problem, but then I lose the callbacks.
>
> That seems strange.
>
> >> You can give a background thread a different priority,
>
> > Yeah, well, the whole thing of using a service is that it's in a
> > separate thread and that it doesn't stop when the activity pauses or
> > stops or gets destroyed.
>
> Yup!
>
> > But maybe I should try forking a separate
> > thread from the service with a lower priority.
>
> If you are using AsyncTask, those threads are already created at a lower
> priority.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> _Android Programming Tutorials_ Version 1.0 Available!
--~--~---------~--~----~------------~-------~--~----~
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