On Mar 19, 1:08 pm, Dianne Hackborn <[email protected]> wrote:
> On Thu, Mar 19, 2009 at 7:33 AM, Hans <[email protected]> wrote:
> > > 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.
>
> Seriously, they don't.  sendBroadcast() will never ever reach a Service.
> When you use registerReciever(), you are creating a dynamic
> BroadcastReceiver and delivery is going there; the Service component is not
> involved at all.

What "don't"?  If the receiver is in my service, it's going to my
service - just via the receiver.  Or are you saying that if my service
contains a broadcast receiver, which registers for broadcasts when the
service starts up, it won't receive broadcasts?  That doens't sound
right.

> > 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?
>
> Again, these are three completely different things.  When share is clicked,
> startActivity() is called.  The ONLY thing that will happen as a result of
> this is an activity being started, so you simply must have an activity
> component that will handle the share intent.
>
> Once you are in your activity, you can start your service or so whatever
> else you want.
>
> > 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?
>
> Correct.
>
> > 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?
>
> That makes it sound complicated. :)  startActivity -> Activity, startService
> -> Service, sendBroadcast -> BroadcastReceiver.  Just don't think of Intent
> as a generic message system where all of them are routed through one common
> channel.  Intent is a primitive data structure with standard semantics for
> declaring and matching a simple language, which is used in various places to
> build specific routing facilities.

The problem is that this IS the message system for Android.

I guess, as usual, a new mindset for solving problems is needed.

I think the only thing I've found missing from the framework point of
view is that PACkAGE_ADDED doesn't get sent to the newly installed
package.

Android is extraordinary, thank you for all the hard work :).

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