On Wed, Mar 18, 2009 at 8:09 PM, Hans <[email protected]> wrote:

> Thanks, I only asked because a cursory glance through
> ChooserActivity.java and ResolverActivity.java didn't provide me with
> anything I could see as discrimination between activities and
> services.  Confirmed with testing tonight.  Appreciated.


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.


> 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.  Neither do
activities.  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.)

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).

-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support.  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 [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
-~----------~----~----~----~------~----~------~--~---

Reply via email to