Well this certainly works in the sample code, so my question would be what
is different about your code.  There are only a few possible things I can
imagine going on:

- You are looking at different RemoteCallbackList instances -- things are
getting added in one, and you are trying to do callbacks from another.
- For some reason the callback is getting unregistered before you try to do
beginBroadcast().
- The processes that have registered have gone away before you do
beginBroadcast(), in which case its registration will be removed from the
list.

On Thu, Feb 12, 2009 at 11:06 AM, Hans <hkess...@gmail.com> wrote:

>
> I'm sorry for not understanding, but it sounds like you're describing
> how to get thread pool requests executed in the main thread, but
> that's not the problem I'm describing (unless I've described it poorly
> [if so, sorry...])
>
> My problem is that as client Activities pass my service their callback
> interfaces, the service's thread pool handles the interface code in my
> service and the thread pool's thread calls
> RemoteCallbackList.register.  When my service wants to send a message
> to the registered client applications it tries to use the interfaces
> which are stored in the RemoteCallbackList object but (and here is the
> problem) there are no registered callbacks in the object.
> RemoteCallbackList.beginBroadcast() returns 0 all the time, no matter
> how many client's successfully bind to my service and register
> themselves for callbacks.
>
> Now, I put a simple bit of debug code to dump out how many clients are
> registered each time the Service interface code is called and the
> number there is exactly as I expect.  When the first one connects, the
> Log.i output shows "1 client connected", when another Activity calls
> to register its callback with my service, the service code reports "2
> clients connected", et cetera.
>
> So, my problem is that when the service's threadpool makes use of my
> service's RemoteCallbackList object, everything is as expected, there
> are several clients registered and their interfaces work, BUT, when my
> service's main thread wants to notify the clients of some even, and it
> tries to use the RemoteCallbackList object, it is empty when the
> thread pool thread reports that it is NOT empty.
>
> Thanks for looking at this for me.  Once I get this licked, I plan to
> write up a very nice bit on how easy (I won't mention this part! LOL)
> getting into Android is and include my service work.
>
>     Thanks :)
> >
>


-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

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