(Great! An answer from the
prestigious M.Murphy!! Great books!!)

Thanks Mark for your answer..

But the Services in "bound" mode are still not clear for me..

Android Doc says:
"If there are clients bound to the service, then the service's hosting
process is never less important than the most important client. That
is, if one of its clients is visible to the user, then the service
itself is considered to be visible. "

So if my most important client gets stopped and goes in the background
(or even worse, is destroyed), the Service process is then ranked in
the same way??  wich means most likely to be also destroyed..
That is my real concern..

Mark, do you confirm my understanding?


On Mar 5, 3:40 pm, Mark Murphy <mmur...@commonsware.com> wrote:
> On Tue, Mar 1, 2011 at 2:06 PM, pedro242 <pedro.contreir...@gmail.com> wrote:
> > When the Service is started, the Android doc is quite clear saying:
> > "If the service has been started, then its hosting process is
> > considered to be less important than any processes that are currently
> > visible to the user on-screen, but more important than any process not
> > visible."
> > => it means that the process is ranked as "Service process" level (Cf.
> > Processes and Threads android doc)
> > As far as i understand, this priority level should warrant us the
> > process will only be killed in a very
> > constraining RAM configuration, and makes it suitable for long time
> > running background thread..
> > Is my understanding correct?
>
> Please do not have a "long time running background thread" except in
> extreme situations (e.g., VOIP client), and even then you will need to
> use startForeground() to keep the service around.
>
> Pure background services (i.e., those without an accompanying activity
> in the foreground) are designed to run for seconds or minutes, not
> hours or days.
>
> > So what the point of launching a background thread in a bound
> > Service?? What's the difference between a simple thread launching from
> > an Activity?
>
> Activities undergo configuration changes, where they get destroyed and
> recreated (e.g., screen rotation). Services do not. Dealing with
> either background threads or bound services is annoying to deal with
> in an Activity.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Android App Developer Books:http://commonsware.com/books

-- 
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