Craig wrote: > It would appear on a G1 (with the latest software update) that onUpdate > () runs even when the widget is not visible.
I believe that is by design, so that the widget contains fresh data when the user pops back to the home screen. > Is there a way of sensing > that the widget is or is not visible or is otherwise in foreground? Not readily that I am aware of. > That is, running the code below shows a logcat message at whatever > interval the Widget is scheduled to update, whether it's in foreground > or not, whether even the screen is dim or otherwise in deep sleep. Correct. If you want to avoid the deep-sleep problem, set the update period in the widget XML to be 0 and use your own AlarmManager to control the update period. There, you can specify a alarm type that does not wake up the device out of a sleep state. > It would seem onUpdate should only be scheduled to run when the Widget > is in the foreground or visible. That is your opinion, and you are welcome to it. Personally, I do not think the current implementation is wrong, but it could use some greater flexibility, to accommodate desires like yours. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Looking for Android opportunities? http://wiki.andmob.org/hado --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

