AIDL vs Messenger

Requirement . You must open the service / contract from another process to other applications. For example: getPhoneRecord (recordId), deletePhoneRecord (phoneId), etc.

Potential Solutions : Messenger or AIDL

Based on my analysis, I believe that AIDL is the only option, because Messenger provides a very general way to send messages through applications. Messenger is limited to sending (Message) on the client side and handleMessage (Message msg) on ​​the server. There are other differences, such as multithreading. But I take care to define an API contract from a service that other applications / consumers can call. Do I understand correctly?

+6
source share
4 answers

Yes, your understanding is correct. In any case, you need to clearly define your API. If you use Messenger, these are just asynchronous user messages, so if you need your service to send data, you will also need some kind of similar client-side mechanism. Using AIDL and binders is more consistent with what you describe what you would like to do.

+2
source

In the documentation for Android:

Most applications should not use AIDL to create a related service, because this may require multi-threaded capabilities and may lead to a more complex implementation.

, , AIDL - . , Android:

, Android

, , ( / . : getPhoneRecord (recordId), deletePhoneRecord (phoneId) ..)

.

  • Binder, , . . .
  • Messenger - . Messenger (Message) handleMessage (Message msg) .
  • AIDL-!

, - .

+9

: .

1) () 2) (), startService . 3) .

+1

, , . -.

AIDL Messenger, AIDL - , .

Messenger:

  • .

  • , .

  • .

  • , , .

  • Messenger , . .

  • , , , AIDL , , .

: http://codetheory.in/android-interprocess-communication-ipc-messenger-remote-bound-services/ https://www.slideshare.net/yoni1984/ipc-aidl-sexy-not-a-curse

AIDL:

0
source

All Articles