On Tue, Mar 22, 2011 at 4:32 PM, Jake Colman <col...@ppllc.com> wrote:

> Do I have to assume that my application might get killed?  If my
> appwidget is sitting on the homescreen and displaying it's data might it
> still be killed even though it's active?  I recognize that my service is
> killed the moment it is done with its work but does the same gold true
> for the appwidget's broadcast receiver?  If the answer is yes, then is
> the apwidget display simply a statically drawn thing that is displayed
> on the screen even if the receiver is dead?
>

Yes.


> I am assuming that your answer to all of the above is: yes, my
> application might get killed.  If so, how do I know when that is
> happening so that I can save my location information somewhere?  How do
> I know when to restore it?  This is not the same issue as with an
> activity where there are specific methods that get overridden. Here I am
> dealing with a "continuously" running (I know it's not really
> continuous) widget so I'm not sure how to handle it.
>

The process can get killed at any time after you return from your receiver
or *any* of the Service callbacks (if there is nothing else keeping it
around).

If you don't have a service running, your process is somewhat by definition
not continuously running and you can't consider it as such.  Even if you do
have a service running, you can count on the process occasionally being
killed in the background though in that case it will generally get restarted
soon after to continue running the service (if there is enough memory to do
so).


> Also, I never see this problem on my own phone and only one user (out of
> appx 180 active widget installations) is complaining.  He is not using a
> task killer so he is not forcing things to be killed.  What might
> explain only one user having an issue.
>

Different phones have different amounts of memory, different numbers of
things running on them competing for memory, different usage patterns of
their users resulting in processes being evicted at different rates, etc.

-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  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 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