On Mon, Dec 1, 2008 at 6:36 AM, joshv <[EMAIL PROTECTED]> wrote:

> Regarding process death and preferences, I thought the same thing so I
> scaled back my persistence code to only save preferences in an onPause
> ().  It was my understanding that even when a task is killed, the
> onPause is called before the process is terminated - is that not the
> case?  Can the process be killed in the middle of the onPause()
> processing?  Perhaps this is a debugger only phenomenon?


There is nothing called "before the process is terminated," if you are
thinking of it as "the system thinks it needs to kill something, so politely
asks it to get ready and then kills it."  What actually happens it that
onPause is called when the system is going to put the process in a
background state, and from there at whatever point the system needs to get
rid of the process it will just kill it, no questions asked.

While onPause() is running, the process is in a foreground state, so it will
not be killed unless the system is so low on memory it needs to kill that
process to continue to have memory for the core system processes...  which
should only happen if the app is just using all of the available memory so
that not even background things can run.  Basically never for non-buggy
apps.

However, your process can get killed if you are installing an update to it,
because the first thing the system does is cleanup and kill all existing
code of the process before installing the update.  We should probably do
something to make this a little more clean for users installing updates.
And this same thing happens every time you run your app from eclipse, since
all it is really doing is telling the system to update to your current
version of the app.

-- 
Dianne Hackborn
Android framework engineer
[EMAIL PROTECTED]

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.

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