On Mon, Nov 1, 2010 at 12:30 PM, jotobjects <[email protected]> wrote:

> Can a Service find out what component caused onBind() and unBind() to
> be invoked?
>

No.  onBind() is only called once for the first request; after that the
system keeps the IBinder and hands it to other requests without bothering
the service.


> Possibly related second question - Why are the Intent extras NOT
> available in onBind() and unBind() as stated in the documentation for
> those methods?
>

Because it is only called for the first request for that particular Intent
(as defined by the intent filtering).  The extras are not part of intent
matching, so relying on them here would be broken.

Keep your onBind() interaction simple.  After that there is a full interface
between the service and its client, with which they can exchange whatever
information they want.  You should look at the Intent as simply specifying
the interface the client would like to bind to.

-- 
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, and so won't reply to such e-mails.  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