Henrik,

SCREEN_OFF is usually followed by the device entering sleep mode, so that
issue pretty much takes care of itself.

Checking for the current virtual home screen, and currently active home app
among several possibly installed doesn't really fit the widget programming
model - it's more a push rather than pull (as it is with regular views, that
are drawn on demand). I hope that home screen apps have some smarts for that
(and maybe they really do).

I found it very useful to implement checks for "stale" widget ids in my
apps, so my code doesn't waste time updating 5-10-88 (yes, I've seen that
number) widgets when there is only one on the screen.

http://kmansoft.wordpress.com/2010/06/22/per-widget-options-stale-widgets

Some causes of this are fixed in 2.2, but I'm keeping that code just in
case.

-- Kostya

2011/1/17 Henrik Lindqvist <[email protected]>

> My AppWidgets are updated by a Service at user-defined intervals or
> when certain intents occur. To save battery, I only update the
> AppWidgets when the screen is on (SCREEN_ON).
>
> Is there any other way to stop updating AppWidgets unnecessarily?
>
> Only when the home screen is visible?
> Only when a specific AppWidget is on screen?
>
> --
> 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]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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