Hm.. let's say i'm not going to schedule next update via alarm if screen is off. Service will shut itself down. Then screens is coming back what will listen to that broadcast ? My goal is eliminate service runs while i don't need to, not minimize amount of work service does during the run.
On Jul 29, 5:08 pm, Mark Murphy <mmur...@commonsware.com> wrote: > Alexey Volovoy wrote: > > Thanks for reply Dianne - my worry is that 30 sec interval for update > > is not enough to let device fall asleep and my updates basically > > prevent that. I've tried to disconnect device for an hour or so and > > it's still updating according to the logs. Do you have any > > recommendation of how i can update widget frequently when device is > > awake and screen is on and don't update at all while it's sleeping ? > > I'm using alarm manager now and the android:updatePeriodMillis="0" in > > the appwidget-provider > > Rather than focusing on "sleeping", perhaps focus on the screen being > off. Listen for the ACTION_SCREEN_OFF and ACTION_SCREEN_ON broadcast > Intents and tailor your behavior at that point. > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://twitter.com/commonsguy > > Android App Developer Training:http://commonsware.com/training.html --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---