[android-developers] Re: RemoteCallbackList register called on one thread, broadcast initiated on another...

2009-02-12 Thread Dianne Hackborn
Incoming calls on an IBinder interface are dispatched from a thread pool maintained by the system in each process, so you basically can't make any assumption about thread those methods will run on. (This is basically the free threaded model in COM if you are familiar with that.) To put work on

[android-developers] Re: RemoteCallbackList register called on one thread, broadcast initiated on another...

2009-02-12 Thread Hans
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

[android-developers] Re: RemoteCallbackList register called on one thread, broadcast initiated on another...

2009-02-12 Thread Dianne Hackborn
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

[android-developers] Re: RemoteCallbackList register called on one thread, broadcast initiated on another...

2009-02-12 Thread Hans
The only thing different, as far as I can tell, between my approach, and the sample's is that the client and service are in the same project and share the same manifest, and in my service's manifest I don't use something like: action android:name=com.example.android.apis.app.REMOTE_SERVICE /

[android-developers] Re: RemoteCallbackList register called on one thread, broadcast initiated on another...

2009-02-12 Thread Hans
Wow, weirdness... Starting the remote service, whose code is in another project than the client's, via a global name resolved the thread issue. So, to sum up: IF you keep your service code in its own project If you don't declare a name like this: action

[android-developers] Re: RemoteCallbackList register called on one thread, broadcast initiated on another...

2009-02-12 Thread Dianne Hackborn
Please see me recent reply to another thread. It sounds like you are running two instances of your service. You do NOT declare the service in the client process, but you DO need to specify the correct component name in the Intent when binding to it from the client -- that is explicitly make a

[android-developers] Re: RemoteCallbackList register called on one thread, broadcast initiated on another...

2009-02-12 Thread Hans
Unless there are some serious bugs in the Log class (which I doubt) it wasn't running two instances of the service because I logged every aspect of the service and the client's life cycles and included thread IDs and process IDs when doing so. I did this for all the variations I used to try and