Skip the work is not a really good option in my case. I have very little work to do, get next headline and push widget update. So it's probably will spend equal amount of time of starting and stopping service alarm manager , yes it's really good option and you don't need set very long time - setting it to 0 does the job.
On Jun 22, 6:00 pm, Mark Murphy <[email protected]> wrote: > Alexey Volovoy wrote: > > hm.. based on the logs from UpdateService onStart - it's still > > executing update after i've uchecked the setting. > > That's odd. That means they must be using a WAKEUP form of AlarmManager. > I would have expected otherwise. > > One option is for you to watch for ACTION_SCREEN_ON and > ACTION_SCREEN_OFF broadcast Intents in your service (or use some other > method to see if the screen is not -- not sure if there's a simple API > for that). When you know the screen is off, skip the work in the update. > > Another alternative is for you to specify an effectively infinitely long > updateTimeMillis (2 billion milliseconds or so is over a year) and use > AlarmManager yourself. You can push updates to the widget whenever you > want -- updateTimeMillis is just a convenient means for doing so. In > your own AlarmManager work, don't use one of the WAKEUP variants, and > the alarm will fire when the phone next awakens if it ordinarily would > have fired while the phone was asleep. > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://twitter.com/commonsguy > > Warescription: Three Android Books, Plus Updates, $35/Year --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

