Question

Based on this message from the AIDL docs there is only one valid usecase for AIDL.

Using AIDL is necessary only if you allow clients from different applications to access your service for IPC and want to handle multithreading in your service.

What exactly does "handle multithreading" mean in this context? Is this more than simply having a service with multiple running threads?

The docs further state:

if you want to perform IPC, but do not need to handle multithreading, implement your interface using a Messenger.

Why is a Messenger unacceptable for a service that supports multithreading? Couldn't communication between threads be handled inside the messenger (without the use of shared memory)?

Is the issue here that this code would be significantly more complicated then using a Handler?

Was it helpful?

Solution

It simply means AIDL calls can be concurrent (e.g. several apps calling the same AIDL interface on same service) because Android handles this for you, but with Messenger it is not (but you can do it manually though).

OTHER TIPS

As per http://developer.android.com/guide/components/bound-services.html. Messnger uses single thread to queue messages. Hence no need to handle any sync issues. In case of AIDL its the responsibility of the developer.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top