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/commonsguy
http://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