On Mar 18, 11:16 pm, Dianne Hackborn <hack...@android.com> wrote:
> They use queryIntentActivities(), which only returns activities.  In the
> package manager, the four component types are completely disjoint, and there
> is simply no call you can make that will give you a mix of them.

Thanks for the info :).

> > BTW, does this mean that services will tend to only get 'sticky'
> > broadcast intents, intents intended explicitly for them from a given
> > activity or service, and the occasional intent that isn't handle by
> > any activity currently registered for it?
>
> Services are just completely different from receivers, which are different
> from activities.  They don't receive any broadcasts at all.

They certainly do when you register for them dynamically.

>  Neither do activities.

Ibidem

> Only receivers do.  (One exception is that you can dynamically
> create a BroadcastReceiver and register it at runtime, but in that case it
> is not the component itself receiving the broadcast.)

Presumably this difference only matters when the code in question is
not yet running.

> In other words:
>
> - You launch activities with startActivity().
> - You send to receivers with sendBroadcast().
> - You bind to services with bindService() (and make them run with
> startService(), but semantically this is not the same at all as starting an
> activity; we probably should have found a different verb to use here).

So - If I have a service that I want to run when certain things
happen, just for an example I want it to run when someone clicks
'share' on the photo viewer menu.
Presuming that service is not running, putting the proper intent
filter in the service's manifest won't make a difference because
services are never evaluated for intents, but a running service with a
broadcast receiver inside of it would have its broadcast receiver
evaluated, correct?

I presume that if you want a service started up because of a standard
broadcast message your service's package would also contain a
broadcast receiver that would actually be what was triggered and it
would in turn start the service, yes/no?

So, to sum up, unless an intent is sent via broadcast, a running
service has no approach to receive intents other than from binds and
starts/stops, correct?

Thanks,

     Hans
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to