I. Use of bundle
When we start the activity, service, and receiver of another process in a process, we can attach the information we need to transmit to the remote process and send it through intent in bundle.
The data we transmit must be able to be serialized.
All the above principles are bundle
Of course the service is also supported by the intent boot to pass the data
This scenario is one of the most simple interprocess communication
Two. Use file sharing
Three. Using Messenger
1. Introduction
The bottom of Messenger is aidl.
The difference between 2.Aidl and Messager
The reason is that aidl can handle multithreading, multiple client concurrent access, and Messenger can only be single-threaded.
Messenger, Aidl, binder the relationship between these three things is this: Aidl is the binder encapsulation, Messenger is the Aidl encapsulation, is to better facilitate the developers in different scenarios using interprocess communication.
Four. Use of Aidl
The foundation of 1.aidl
Aidl are often based on binding services, aidl the bottom is binder
The binding service is not part of a cross process, so do not mix it with aidl, except that the binding service is often used when IPC is used in Aidl mode.
2.aidl principle
Based on the Proxy_stub mode description, specific reference to the previous blog.
3. Specific process
!!! In fact, the core is the definition of Aidl interface.
Service side
1. Server-side first to create a service to listen to the client's link request
2. Then create a aidl file that will be exposed to the client interface in this aidl file.
3. Finally in the service to achieve this aidl can be.
Client
1. What the client needs to do is a little simpler, first of all, to bind service-side services,
2. After the binding succeeds, the binder object returned by the server is converted to the type that the Aidl interface belongs to.
3. Then you can call the method in the Aidl.
The above description is only a perceptual process, the aidl of the implementation process is far more than that simple.
4. An example
See:
Https://github.com/zhujainxipan/MyApplication
http://android.jobbole.com/80789/
Five. Use of ContentProvider
Six. Use socket