On Tue, Mar 22, 2011 at 7:32 PM, Jake Colman <col...@ppllc.com> wrote:
> If my
> appwidget is sitting on the homescreen and displaying it's data might it
> still be killed even though it's active?

Your app widget is not "sitting on the homescreen". It is never
"sitting on the homescreen".

Your app widget, from the standpoint of your code, is a
BroadcastReceiver (AppWidgetProvider), perhaps with some other classes
(e.g., an IntentService).

What *is* "sitting on the homescreen" are Views, created based on a
definition you set up in the form of a RemoteViews. The RemoteViews is
transferred, via inter-process communication, from your process to the
home screen's process.

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

Yes. This is true of all manifest-registered broadcast receivers.

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

Absolutely. That is the entire point of an app widget.

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

When you get your location information, save it, or just update app
widget's RemoteViews.

> How do
> I know when to restore it?

When you are called with onUpdate() in your AppWidgetProvider, load
your data, if needed.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 3.5 Available!

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