>>>>>> "KV" == Kostya Vasilyev <kmansoft@gmail.com> writes:
>
> KV> As far as Android is concerned, IntentService knows nothing about
> KV> home screen widgets.
>
> KV> Since you know which widget receivers' onUpdate was called, pass
> KV> this information to the service (e.g. by setting an intent
> KV> extra).
>
> I implemented two Broadcast Receivers, one for each widget size. Both
> receivers have the same set of intent filters. If I instantiate just
> one size widget and broadcast an intent, both receivers respond to that
> intent - even though only one size widget has been instantiated.
>
> Does this make sense? Should the "large" receiver respond to intents if
> only the small widget has been instantiated?
Sure. To paraphrase Kostya, as far as Android is concerned, intent
filters know nothing about home screen app widgets.
If you have one BroadcastReceiver in your manifest with an intent
filter, and you send a broadcast matching that filter, one
BroadcastReceiver will respond.
If you have two BroadcastReceivers in your manifest with the same
intent filter, and you send a broadcast matching that filter, two
BroadcastReceivers will respond.
If you have 1,337 BroadcastReceivers in your manifest with the same
intent filter, and you send a broadcast matching that filter, 1,337
BroadcastReceivers will respond.
This begs the question of why you have multiple AppWidgetProviders.
You only need one.
To tell small from large, call getAppWidgetInfo() on the
AppWidgetManager inside your onUpdate() or wherever. That will return
a Java object mirroring your <appwidget-provider> XML element. Use the
minWidth and minHeight values, or possibly the initialLayout value, to
determine which size it is.
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy
Android Training in London: http://bit.ly/smand1, http://bit.ly/smand2
--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en