Kostya, Hmmmmmm.
Whenever the alarm in AppWidgetProvider is triggered, I have to update all widget instances as per the widget-specific preference. Based on what you have suggested, does the following make sense: 1) In the AppWidgetProvider's onReceive() method when it receives the intent from the alarm, it cycles through all valid widgetids and starts the service with an intent containing that widgetid. Actually, I can just invoke with service once with an intent containing the list of all valid widgetids. 2) The service cycles through the list of widgetids and updates each widget's remoteview using the widget-specific preference. I didn't check it just now but I'm sure I can get each widget's RemoteView and update each one separately. 3) I currently set the remoteview's onClickPendingIntent in the service. Which means I am setting it up every time the service updates the remoteview. Is that really the best way to do it? Can I set the remoteview's onClickPendingIntent in the AppWidgetProvider or, since the AppWidgetProvider regularly gets destroyed I cannot do it there? ...Jake >>>>> "KV" == Kostya Vasilyev <kmans...@gmail.com> writes: KV> Jake, KV> You can get a list of widget ids by doing something like: KV> AppWidgetManager appWidgetManager = KV> AppWidgetManager.getInstance(context); KV> ComponentName provider = new ComponentName(context, Widget.class); KV> int[] widgets = appWidgetManager.getAppWidgetIds(provider); KV> This widget id list need to be filtered for "stale" ones. KV> -- Kostya KV> 03.05.2011 23:58, Jake Colman пишет: >> Kostya, >> >> Gee, I hope I'm not revealing my ignorance here... >> >> I build my RemoteViews in an IntentService. I suppose I have to find a >> way to pass the widgetid into the Intent that is used to start the >> service. If the service knows the widgetid, it can putExtra that >> widgetid into the Intent used to start the Preference Activity. >> >> So now the question is how to get widgetid ID from the AppWidgetProvider >> to the IntentService. onUpdate() is passed the appWidgetIds that need >> to be updated. I, however, do not use that method for anything. >> Instead, I use alarms to trigger my updates since I am updating every 60 >> seconds in one instance or every 24 hours in another. Currently my >> alarms send an Intent that is processed by the AppWidgetProvider's >> onReceive() method. That method does not get a widgetid. Any idea how >> I can get the set of widgetids to be updated if Android has no passed it >> to me in onUpdate? >> >> ...Jake KV> -- KV> Kostya Vasilyev -- http://kmansoft.wordpress.com KV> -- KV> You received this message because you are subscribed to the Google KV> Groups "Android Developers" group. KV> To post to this group, send email to android-developers@googlegroups.com KV> To unsubscribe from this group, send email to KV> android-developers+unsubscr...@googlegroups.com KV> For more options, visit this group at KV> http://groups.google.com/group/android-developers?hl=en -- Jake Colman -- Android Tinkerer -- 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