[android-developers] Re: Widgets ( frequent updates )
At this moment no - but in new version i've provided ability to refresh content on demand. hopefully it'll solve complains problem On Jul 31, 9:15 am, String wrote: > On Jul 31, 2:46 pm, Alexey Volovoy wrote: > > > Rationale behind frequent updates - if i'm not rotating headlines in > > visible fashion people complain that widget is "not working". > > Have you made the update interval user-configurable? I'd like to think > this would cut down on such complaints, or at least give you somewhere > to point them. > > String --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: Widgets ( frequent updates )
At this moment no - but in new version i've provided ability to refresh content on demand. hopefully it'll solve complains problem On Jul 31, 9:15 am, String wrote: > On Jul 31, 2:46 pm, Alexey Volovoy wrote: > > > Rationale behind frequent updates - if i'm not rotating headlines in > > visible fashion people complain that widget is "not working". > > Have you made the update interval user-configurable? I'd like to think > this would cut down on such complaints, or at least give you somewhere > to point them. > > String --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: Widgets ( frequent updates )
At this moment no - but in new version i've provided ability to refresh content on demand. hopefully it'll solve complains problem On Jul 31, 9:15 am, String wrote: > On Jul 31, 2:46 pm, Alexey Volovoy wrote: > > > Rationale behind frequent updates - if i'm not rotating headlines in > > visible fashion people complain that widget is "not working". > > Have you made the update interval user-configurable? I'd like to think > this would cut down on such complaints, or at least give you somewhere > to point them. > > String --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: Widgets ( frequent updates )
On Jul 31, 2:46 pm, Alexey Volovoy wrote: > Rationale behind frequent updates - if i'm not rotating headlines in > visible fashion people complain that widget is "not working". Have you made the update interval user-configurable? I'd like to think this would cut down on such complaints, or at least give you somewhere to point them. String --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: Widgets ( frequent updates )
that's what i did. it is set to 0. and i'm updating via alarm manager. and i'm scheduling with setInexactRepeating(). Further looking into the log tonight - it's is working, i had some cases with 5-10 minutes without logging an update. Of course my update will join any other update that wakes device up ( gmail, twitter feed etc ). Bottom line - it's working as designed, but due to the nature of the widget it's still be nicer to base updates on the screen state rather on device state. I'd rather cancel all alarms if screen is off and start scheduling new ones once it back on.. Rationale behind frequent updates - if i'm not rotating headlines in visible fashion people complain that widget is "not working". Service is basically just puts new headline and image on RemoteViews. On Jul 31, 12:27 am, Jeff Sharkey wrote: > 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;... > > 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 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 -~--~~~~--~~--~--~---
[android-developers] Re: Widgets ( frequent updates )
that's what i did. it is set to 0. and i'm updating via alarm manager. and i'm scheduling with setInexactRepeating(). Further looking into the log tonight - it's is working, i had some cases with 5-10 minutes without logging an update. Of course my update will join any other update that wakes device up ( gmail, twitter feed etc ). Bottom line - it's working as designed, but due to the nature of the widget it's still be nicer to base updates on the screen state rather on device state. I'd rather cancel all alarms if screen is off and start scheduling new ones once it back on.. Rationale behind frequent updates - if i'm not rotating headlines in visible fashion people complain that widget is "not working". Service is basically just puts new headline and image on RemoteViews. On Jul 31, 12:27 am, Jeff Sharkey wrote: > 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;... > > 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 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 -~--~~~~--~~--~--~---
[android-developers] Re: Widgets ( frequent updates )
Jeff Sharkey wrote: > Several places it's been > mentioned that you should avoid update intervals shorter than, say, > every hour, precisely because of this fact. Ah. I thought the "nothing shorter than an hour" was due to some expense of updating RemoteViews. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android App Developer Books: http://commonsware.com/books.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 -~--~~~~--~~--~--~---
[android-developers] Re: Widgets ( frequent updates )
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 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 -~--~~~~--~~--~--~---
[android-developers] Re: Widgets ( frequent updates )
is there anyway to get to the state of the phone/screen without listening to broadcasts ? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: Widgets ( frequent updates )
Oh man.. that not going to fly .. I can't do it from the service, because service runs like for a second to update the widget and stopSelf(). So if i register something onStart() i'd have to unregister that onDestroy(). Therefore to actually catch that event while service is running becomes kind of tricky. Sigh.. still don't understand why the hell it running updates during the sleep... On Jul 30, 3:16 pm, "Mark Murphy" wrote: > > Ok.. so i already have an receiver for the widget... and adding > > screen_on/screen_off should do it ? > > > > > android:label="@string/app_name" > > > > > > android:name="android.intent.action.SCREEN_ON" /> > > > android:name="android.intent.action.SCREEN_OFF" /> > > > android:name="android.appwidget.action.APPWIDGET_UPDATE" /> > > > > > android:resource="@xml/widget_news" /> > > > > Strangely i don't receive SCREEN_OFF/SCREEN_ON in my > > �...@override > > public void onReceive(Context context, Intent intent) { > > } > > Nuts. Further research indicates that, at least as of last December, you > can only get SCREEN_OFF/SCREEN_ON from in-Java registered receivers: > > http://groups.google.com/group/android-developers/browse_frm/thread/8... > > -- > Mark Murphy (a Commons Guy)http://commonsware.com > Android App Developer Books:http://commonsware.com/books.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 -~--~~~~--~~--~--~---
[android-developers] Re: Widgets ( frequent updates )
> Ok.. so i already have an receiver for the widget... and adding > screen_on/screen_off should do it ? > > android:label="@string/app_name" > > > android:name="android.intent.action.SCREEN_ON" /> > android:name="android.intent.action.SCREEN_OFF" /> > android:name="android.appwidget.action.APPWIDGET_UPDATE" /> > > android:resource="@xml/widget_news" /> > > Strangely i don't receive SCREEN_OFF/SCREEN_ON in my > @Override > public void onReceive(Context context, Intent intent) { > } Nuts. Further research indicates that, at least as of last December, you can only get SCREEN_OFF/SCREEN_ON from in-Java registered receivers: http://groups.google.com/group/android-developers/browse_frm/thread/81d84efa68578924/e470ffd0dab85086?lnk=gst&q=screen_on# -- Mark Murphy (a Commons Guy) http://commonsware.com Android App Developer Books: http://commonsware.com/books.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 -~--~~~~--~~--~--~---
[android-developers] Re: Widgets ( frequent updates )
Ok.. so i already have an receiver for the widget... and adding screen_on/screen_off should do it ? Strangely i don't receive SCREEN_OFF/SCREEN_ON in my @Override public void onReceive(Context context, Intent intent) { } On Jul 29, 5:20 pm, Mark Murphy wrote: > Alexey Volovoy wrote: > > 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 ? > > A BroadcastReceiver registered in your manifest. That receiver then > starts up your service. You may already have one of these if your > service needs to start up at boot time. > > -- > 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 -~--~~~~--~~--~--~---
[android-developers] Re: Widgets ( frequent updates )
Alexey Volovoy wrote: > 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 ? A BroadcastReceiver registered in your manifest. That receiver then starts up your service. You may already have one of these if your service needs to start up at boot time. -- 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 -~--~~~~--~~--~--~---
[android-developers] Re: Widgets ( frequent updates )
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 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 -~--~~~~--~~--~--~---
[android-developers] Re: Widgets ( frequent updates )
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 -~--~~~~--~~--~--~---
[android-developers] Re: Widgets ( frequent updates )
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 On Jul 29, 4:18 pm, Dianne Hackborn wrote: > Being plugged in to usb keeps the device awake. There are also often things > that will wake up the device in the background that can allow your own alarm > to go off. > > > > On Wed, Jul 29, 2009 at 1:06 PM, Alexey Volovoy wrote: > > > I don't set any WakeLocks . So yes it's seems to be something is > > preventing device to go to sleep .. And i think it's my frequent > > updates. I set go to sleep on red button via spare parts which will do > > this: > > 07-29 14:59:39.986: DEBUG/WindowManager(58): I'm tired > > mEndcallBehavior=0x2 > > 07-29 14:59:40.234: DEBUG/Sensors(58): sensors=, real= > > 07-29 14:59:40.424: DEBUG/AKMD(39): Compass CLOSE > > 07-29 14:59:40.574: DEBUG/SurfaceFlinger(58): About to give-up screen, > > flinger = 0x16a458 > > then i see this > > 07-29 14:59:50.014: DEBUG/UpdateService(3813): Requested UPDATE_ALL > > action > > 07-29 14:59:50.014: DEBUG/UpdateService(3813): OnStart() > > 07-29 14:59:50.024: DEBUG/UpdateService(3813): Processing thread > > started > > 07-29 14:59:50.024: DEBUG/UpdateService(3813): Widget ID:11 > > 07-29 14:59:50.024: DEBUG/UpdateService(3813): > > Info:AppWidgetProviderInfo(provider=ComponentInfo{package/ > > package.widget.NewsWidget}) > > 07-29 14:59:50.024: DEBUG/MPPNewsWidget(3813): buildUpdate() > > 07-29 14:59:50.034: DEBUG/MPPNewsWidget(3813): getNextItem:position{4} > > size {10} > > 07-29 14:59:50.074: DEBUG/MPPNewsWidget(3813): UpdateIntent:25598174 > > 07-29 14:59:50.074: DEBUG/MPPNewsWidget(3813): widgetID:11 > > 07-29 14:59:50.114: DEBUG/UpdateService(3813): Widget ID:12 > > 07-29 14:59:50.124: DEBUG/UpdateService(3813): > > Info:AppWidgetProviderInfo(provider=ComponentInfo{package.dev/ > > package.NewsWidget}) > > 07-29 14:59:50.124: DEBUG/MPPNewsWidget(3813): buildUpdate() > > 07-29 14:59:50.134: DEBUG/MPPNewsWidget(3813): getNextItem:position > > {31} size {40} > > r=2009-07-28T194846Z_01_BTRE56L0YDE00_RTROPTP_0_PEOPLE- > > JACKSON&w=&w=150 > > 07-29 14:59:50.184: DEBUG/MPPNewsWidget(3813): UpdateIntent:25579477 > > 07-29 14:59:50.194: DEBUG/MPPNewsWidget(3813): widgetID:12 > > 07-29 14:59:50.234: INFO/ActivityManager(58): Stopping service: > > package.dev/package.widget.UpdateService > > and like this every 30 sec .. then after i press menu again i see.. > > 07-29 15:03:49.568: DEBUG/KeyguardViewMediator(58): wakeWhenReadyLocked > > (82) > > 07-29 15:03:49.568: DEBUG/KeyguardViewMediator(58): handleWakeWhenReady > > (82) > > 07-29 15:03:49.574: DEBUG/KeyguardViewMediator(58): pokeWakelock(5000) > > 07-29 15:03:49.584: DEBUG/AKMD(39): Compass OPEN > > 07-29 15:03:49.594: DEBUG/Sensors(58): sensors=0001, real=0001 > > 07-29 15:03:49.794: DEBUG/SurfaceFlinger(58): Screen about to return, > > flinger = 0x16a458 > > > Now i disconnected the device from usb and will see if that will do > > the trick. > > > On Jul 29, 2:49 pm, Mark Murphy wrote: > > > Alexey Volovoy wrote: > > > > I see it the logs of course. Every 30 sec it's starting the service as > > > > it should if it's not asleep. > > > > Are you holding a WakeLock anywhere? > > > > Is anything else perhaps keeping the device/emulator awake? In other > > > words, how do you know it went to sleep? > > > > -- > > > Mark Murphy (a Commons Guy)http://commonsware.com| > >http://twitter.com/commonsguy > > > > Looking for Android opportunities?http://wiki.andmob.org/hado > > -- > Dianne Hackborn > Android framework engineer > hack...@android.com > > Note: please don't send private questions to me, as I don't have time to > provide private support, and so won't reply to such e-mails. All such > questions should be posted on public forums, where I and others can see and > answer them. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: Widgets ( frequent updates )
Being plugged in to usb keeps the device awake. There are also often things that will wake up the device in the background that can allow your own alarm to go off. On Wed, Jul 29, 2009 at 1:06 PM, Alexey Volovoy wrote: > > I don't set any WakeLocks . So yes it's seems to be something is > preventing device to go to sleep .. And i think it's my frequent > updates. I set go to sleep on red button via spare parts which will do > this: > 07-29 14:59:39.986: DEBUG/WindowManager(58): I'm tired > mEndcallBehavior=0x2 > 07-29 14:59:40.234: DEBUG/Sensors(58): sensors=, real= > 07-29 14:59:40.424: DEBUG/AKMD(39): Compass CLOSE > 07-29 14:59:40.574: DEBUG/SurfaceFlinger(58): About to give-up screen, > flinger = 0x16a458 > then i see this > 07-29 14:59:50.014: DEBUG/UpdateService(3813): Requested UPDATE_ALL > action > 07-29 14:59:50.014: DEBUG/UpdateService(3813): OnStart() > 07-29 14:59:50.024: DEBUG/UpdateService(3813): Processing thread > started > 07-29 14:59:50.024: DEBUG/UpdateService(3813): Widget ID:11 > 07-29 14:59:50.024: DEBUG/UpdateService(3813): > Info:AppWidgetProviderInfo(provider=ComponentInfo{package/ > package.widget.NewsWidget}) > 07-29 14:59:50.024: DEBUG/MPPNewsWidget(3813): buildUpdate() > 07-29 14:59:50.034: DEBUG/MPPNewsWidget(3813): getNextItem:position{4} > size {10} > 07-29 14:59:50.074: DEBUG/MPPNewsWidget(3813): UpdateIntent:25598174 > 07-29 14:59:50.074: DEBUG/MPPNewsWidget(3813): widgetID:11 > 07-29 14:59:50.114: DEBUG/UpdateService(3813): Widget ID:12 > 07-29 14:59:50.124: DEBUG/UpdateService(3813): > Info:AppWidgetProviderInfo(provider=ComponentInfo{package.dev/ > package.NewsWidget}) > 07-29 14:59:50.124: DEBUG/MPPNewsWidget(3813): buildUpdate() > 07-29 14:59:50.134: DEBUG/MPPNewsWidget(3813): getNextItem:position > {31} size {40} > r=2009-07-28T194846Z_01_BTRE56L0YDE00_RTROPTP_0_PEOPLE- > JACKSON&w=&w=150 > 07-29 14:59:50.184: DEBUG/MPPNewsWidget(3813): UpdateIntent:25579477 > 07-29 14:59:50.194: DEBUG/MPPNewsWidget(3813): widgetID:12 > 07-29 14:59:50.234: INFO/ActivityManager(58): Stopping service: > package.dev/package.widget.UpdateService > and like this every 30 sec .. then after i press menu again i see.. > 07-29 15:03:49.568: DEBUG/KeyguardViewMediator(58): wakeWhenReadyLocked > (82) > 07-29 15:03:49.568: DEBUG/KeyguardViewMediator(58): handleWakeWhenReady > (82) > 07-29 15:03:49.574: DEBUG/KeyguardViewMediator(58): pokeWakelock(5000) > 07-29 15:03:49.584: DEBUG/AKMD(39): Compass OPEN > 07-29 15:03:49.594: DEBUG/Sensors(58): sensors=0001, real=0001 > 07-29 15:03:49.794: DEBUG/SurfaceFlinger(58): Screen about to return, > flinger = 0x16a458 > > > Now i disconnected the device from usb and will see if that will do > the trick. > > > On Jul 29, 2:49 pm, Mark Murphy wrote: > > Alexey Volovoy wrote: > > > I see it the logs of course. Every 30 sec it's starting the service as > > > it should if it's not asleep. > > > > Are you holding a WakeLock anywhere? > > > > Is anything else perhaps keeping the device/emulator awake? In other > > words, how do you know it went to sleep? > > > > -- > > Mark Murphy (a Commons Guy)http://commonsware.com| > http://twitter.com/commonsguy > > > > Looking for Android opportunities?http://wiki.andmob.org/hado > > > -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: Widgets ( frequent updates )
I don't set any WakeLocks . So yes it's seems to be something is preventing device to go to sleep .. And i think it's my frequent updates. I set go to sleep on red button via spare parts which will do this: 07-29 14:59:39.986: DEBUG/WindowManager(58): I'm tired mEndcallBehavior=0x2 07-29 14:59:40.234: DEBUG/Sensors(58): sensors=, real= 07-29 14:59:40.424: DEBUG/AKMD(39): Compass CLOSE 07-29 14:59:40.574: DEBUG/SurfaceFlinger(58): About to give-up screen, flinger = 0x16a458 then i see this 07-29 14:59:50.014: DEBUG/UpdateService(3813): Requested UPDATE_ALL action 07-29 14:59:50.014: DEBUG/UpdateService(3813): OnStart() 07-29 14:59:50.024: DEBUG/UpdateService(3813): Processing thread started 07-29 14:59:50.024: DEBUG/UpdateService(3813): Widget ID:11 07-29 14:59:50.024: DEBUG/UpdateService(3813): Info:AppWidgetProviderInfo(provider=ComponentInfo{package/ package.widget.NewsWidget}) 07-29 14:59:50.024: DEBUG/MPPNewsWidget(3813): buildUpdate() 07-29 14:59:50.034: DEBUG/MPPNewsWidget(3813): getNextItem:position{4} size {10} 07-29 14:59:50.074: DEBUG/MPPNewsWidget(3813): UpdateIntent:25598174 07-29 14:59:50.074: DEBUG/MPPNewsWidget(3813): widgetID:11 07-29 14:59:50.114: DEBUG/UpdateService(3813): Widget ID:12 07-29 14:59:50.124: DEBUG/UpdateService(3813): Info:AppWidgetProviderInfo(provider=ComponentInfo{package.dev/ package.NewsWidget}) 07-29 14:59:50.124: DEBUG/MPPNewsWidget(3813): buildUpdate() 07-29 14:59:50.134: DEBUG/MPPNewsWidget(3813): getNextItem:position {31} size {40} r=2009-07-28T194846Z_01_BTRE56L0YDE00_RTROPTP_0_PEOPLE- JACKSON&w=&w=150 07-29 14:59:50.184: DEBUG/MPPNewsWidget(3813): UpdateIntent:25579477 07-29 14:59:50.194: DEBUG/MPPNewsWidget(3813): widgetID:12 07-29 14:59:50.234: INFO/ActivityManager(58): Stopping service: package.dev/package.widget.UpdateService and like this every 30 sec .. then after i press menu again i see.. 07-29 15:03:49.568: DEBUG/KeyguardViewMediator(58): wakeWhenReadyLocked (82) 07-29 15:03:49.568: DEBUG/KeyguardViewMediator(58): handleWakeWhenReady (82) 07-29 15:03:49.574: DEBUG/KeyguardViewMediator(58): pokeWakelock(5000) 07-29 15:03:49.584: DEBUG/AKMD(39): Compass OPEN 07-29 15:03:49.594: DEBUG/Sensors(58): sensors=0001, real=0001 07-29 15:03:49.794: DEBUG/SurfaceFlinger(58): Screen about to return, flinger = 0x16a458 Now i disconnected the device from usb and will see if that will do the trick. On Jul 29, 2:49 pm, Mark Murphy wrote: > Alexey Volovoy wrote: > > I see it the logs of course. Every 30 sec it's starting the service as > > it should if it's not asleep. > > Are you holding a WakeLock anywhere? > > Is anything else perhaps keeping the device/emulator awake? In other > words, how do you know it went to sleep? > > -- > 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 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 -~--~~~~--~~--~--~---
[android-developers] Re: Widgets ( frequent updates )
Alexey Volovoy wrote: > I see it the logs of course. Every 30 sec it's starting the service as > it should if it's not asleep. Are you holding a WakeLock anywhere? Is anything else perhaps keeping the device/emulator awake? In other words, how do you know it went to sleep? -- 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 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 -~--~~~~--~~--~--~---
[android-developers] Re: Widgets ( frequent updates )
I see it the logs of course. Every 30 sec it's starting the service as it should if it's not asleep. On Jul 29, 2:35 pm, Mark Murphy wrote: > Alexey Volovoy wrote: > > Well.. i've tried to use alarm manager like: > > AlarmManager alarmManager = (AlarmManager)getSystemService > > (Context.ALARM_SERVICE); > > alarmManager.set(AlarmManager.RTC, nextUpdate, pendingIntent); > > thinking behind it was - if devices is not a sleep, i'll loop through > > my headlines in 30 sec interval. If it goes a sleep i don't need to do > > anything. > > Well after putting devices to sleep i still see updates. It's > > obviously i'm doing something wrong but have no idea what exactly.. > > If the device is asleep, how do you "see" updates? > > Bear in mind: > > "This alarm does not wake the device up; if it goes off while the device > is asleep, it will not be delivered until the next time the device wakes > up. " > > Hence, it may be you are getting the alarm as you are coming out of sleep. > > -- > 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 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 -~--~~~~--~~--~--~---
[android-developers] Re: Widgets ( frequent updates )
Alexey Volovoy wrote: > Well.. i've tried to use alarm manager like: > AlarmManager alarmManager = (AlarmManager)getSystemService > (Context.ALARM_SERVICE); > alarmManager.set(AlarmManager.RTC, nextUpdate, pendingIntent); > thinking behind it was - if devices is not a sleep, i'll loop through > my headlines in 30 sec interval. If it goes a sleep i don't need to do > anything. > Well after putting devices to sleep i still see updates. It's > obviously i'm doing something wrong but have no idea what exactly.. If the device is asleep, how do you "see" updates? Bear in mind: "This alarm does not wake the device up; if it goes off while the device is asleep, it will not be delivered until the next time the device wakes up. " Hence, it may be you are getting the alarm as you are coming out of sleep. -- 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 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 -~--~~~~--~~--~--~---
[android-developers] Re: Widgets ( frequent updates )
Well.. i've tried to use alarm manager like: AlarmManager alarmManager = (AlarmManager)getSystemService (Context.ALARM_SERVICE); alarmManager.set(AlarmManager.RTC, nextUpdate, pendingIntent); thinking behind it was - if devices is not a sleep, i'll loop through my headlines in 30 sec interval. If it goes a sleep i don't need to do anything. Well after putting devices to sleep i still see updates. It's obviously i'm doing something wrong but have no idea what exactly.. On Jun 22, 9:09 pm, Alexey Volovoy wrote: > 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 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 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 -~--~~~~--~~--~--~---
[android-developers] Re: Widgets ( frequent updates )
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 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 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 -~--~~~~--~~--~--~---
[android-developers] Re: Widgets ( frequent updates )
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 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 -~--~~~~--~~--~--~---
[android-developers] Re: Widgets ( frequent updates )
hm.. based on the logs from UpdateService onStart - it's still executing update after i've uchecked the setting. On Jun 22, 4:35 pm, Alexey Volovoy wrote: > One sec.. you might be right - i think i have a dev setting on the > phone that prevents it from sleeping .. > > On Jun 22, 4:31 pm, Mark Murphy 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 > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: Widgets ( frequent updates )
One sec.. you might be right - i think i have a dev setting on the phone that prevents it from sleeping .. On Jun 22, 4:31 pm, Mark Murphy 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 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: Widgets ( frequent updates )
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 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---