A quick question: the Android docs say very clearly that Messenger is an alternative for AIDL for IPC (inter process communication). They never explicitly say though if this extends to processes running in different applications, or just within one app. I strongly suspect the former, but wanted to check.
Thanks! Jan
This technique allows you to perform interprocess communication (IPC) without the need to use AIDL. Using a Messenger for your interface is simpler than using AIDL because Messenger queues all calls to the service. A pure AIDL interface sends simultaneous requests to the service, which must then handle multi-threading.
# When to use AIDLYour service wants to handle multithreading for IPC(any method defined in service can be executed simultaneously by more than one application). If you want to share data and control something in another application. You want to create some new functionalities and distribute them as a library.
The Android Interface Definition Language (AIDL) is similar to other IDLs you might have worked with. It allows you to define the programming interface that both the client and service agree upon in order to communicate with each other using interprocess communication (IPC).
There are 3 basic methods used for IPC on Android: AIDL. Messenger. Broadcast.
AIDL is only really used for inter-app IPC. While it is possible to use AIDL for internal communication, it doesn't buy you anything and puts limitations on your Binder
implementations.
Moreover, one application does not have more than one process, in the vast majority of cases. There is little reason for most apps to have multiple processes.
Messenger
, createPendingResult()
, ResultReceiver
, private broadcast Intents
-- all of these are ways for a service to communicate with a client across process boundaries.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With