When you register for AppWidget updates through the updatePeriodMillis
parameter, the system schedules an update for you using
setInexactRepeating() with a WAKEUP flag.  (Which forces the device
awake for every update.)  Here's the relevant system service code:

http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=services/java/com/android/server/AppWidgetService.java;hb=cupcake#l609

The rationale behind this is that users don't want all their widgets
to begin updating the moment they wake up a phone, slowing it down.
Any updates should continue happening, even when the phone is asleep,
so widgets are always ready and updated.  Several places it's been
mentioned that you should avoid update intervals shorter than, say,
every hour, precisely because of this fact.

Keep in mind that you're completely free to set updatePeriodMillis to
"0" (which disables updates) and manage your own update alarms without
the WAKEUP flag.

j


On Mon, Jun 22, 2009 at 2:31 PM, Mark Murphy<mmur...@commonsware.com> wrote:
>
> Alexey Volovoy wrote:
>> Hi All , i'm looking for the best strategy for the following -- widget
>> suppose to go through cached headlines. And once a 3 hours or so -
>> pull new ones.
>> Update are scheduled from widget config file. Everything seems to be
>> working, except I don't want to running my updates which are simply
>> changing info on the screen while phone is sleeping. What's the best
>> strategy to avoid that ? Desired  behavior - phone is not sleeping -
>> i'll run update which will change headline to next one and check if
>> there is  a time to pull new headlines. If phone is sleeping - i don't
>> want to do any of that.
>
> AFAIK, widgets don't update while the device is asleep. Do you have
> evidence to the contrary?
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://twitter.com/commonsguy
>
> Android Development Wiki: http://wiki.andmob.org
>
> >
>



-- 
Jeff Sharkey
jshar...@android.com

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