Yes, i ran into the very same problem.
>From what I understood with documentation and logcat traces, I may be
wrong for some details but here's the general idea:
My background service (I use startService/stopService to handle an
XMPP connection and notifying the user of events when no activity is
running/binding to it) can be killed when the phone is on low memory
(e.g. under 16 MB on my G1, this the value of the "threshold", see the
ActivityManager class, very interesting monitoring functions...).
Android first calls onLowMemory() on Activity, Service and Application
classes to give applications a chance to free some memory.
After that, android kills the most memory consumer services until the
phone's free memory is greater than the threshold, in the logcat you
will see tons of traces about all that process.
Services that are killed for memory reasons are scheduled for a
restart (you will also see a logcat trace for that).

On Jan 30, 9:09 pm, brs <bernhard.r.su...@gmail.com> wrote:
> I have an app loosely based on the LocalService example from the SDK
> with a controller activity and a long-running, stateful service which
> is doing stuff on a periodic handler. The service is also a bit of a
> memory hog.
>
> It seems that the service is sometimes killed by the activity-manager
> and immediately restarted. I don't see any stack trace, so I assume it
> is not the application crashing but the system doing that, presumably
> to claim resources. Is that what is going on here?
>
> Is there a way to tell the system that this process is kind of
> important, even though it has no foreground activity and should only
> be killed as a last resort?
>
> Bernhard
--~--~---------~--~----~------------~-------~--~----~
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