Sixteen, IPC summarized in Android

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/yz_cfm/article/details/90613126

    This, Android in several common methods and IPC finished, a total of six kinds: Bundle, File Sharing, Messenger, ContentProvider, AIDL, Socket, the following look at their strengths and weaknesses as well as usage scenarios:

    1. Bundle:

    Its advantage is very simple to use, the disadvantage is not much supported data types. Application scenarios: Android between the inter-process communication four component (transmitted through the implicit Intent).

    2. File sharing:

    Bundle and the same, the advantage is to use simple to use. The disadvantage is not applicable with high concurrent access, and you can not do inter-process communication. Applicable scene: No concurrent access situation, a simple exchange of data and less demanding real-time scene.

    3. Messenger:

    The advantage is ease of use, many serial communications support (as a server for a message to be processed), to support real-time communications. The disadvantage is that does not handle high concurrent situation, does not support RPC, data is transmitted via Message, Message and transmitted by carrying the Bundle, Bundle can only support the transmission of the data types supported. Application scenarios: a low-to-many communication concurrent demand without RPC, the RPC return results or no demand.

    4. AIDL:

    The advantage is powerful, supporting many concurrent communication, support real-time communication. The disadvantage is a little more complicated to use, pay attention to handle the thread through. Applicable scene: There are many instant messaging and RPC needs.

    5. ContentProvider:

    The advantage is in terms of access to the data source powerful capabilities to support many concurrent data sharing, can expand other operations by Call method. The disadvantage is that function limitations, mainly provides data source CRUD operations, as will be appreciated AIDL constrained. Applicable scene: data sharing process among many.

    6. Socket:

    The advantage is powerful, the byte stream can be transmitted over a network, to support many concurrent real-time communication. The disadvantage is a little cumbersome to implement, does not support direct RPC. Applicable scene: network data exchange.

----------------------------------------------------(Chapter 2)The end----------------------------------------------------

        -------------------------------------------------- - thanks just brother --------------------------------------------- -------

Guess you like

Origin blog.csdn.net/yz_cfm/article/details/90613126
IPC