The Android system is a house. There is a normal executive company stationed in this
The CPU is the boss of this company
The process is the office in the company, the Office does not work
A thread is an employee in an office, always a worker.
There can be multiple employees in an office, and there's an activity outside the office called the main thread
The company will definitely have a lot of functional departments
Activity service provider Brocastrecive are all functional departments
Now the company has a customer has a demand. Several departments are required to cooperate in the completion of skills. So the company's business people app with the boss to apply for an office to complete customer demand work
Of course, in order to work more effectively, some departments may need a separate office is also able to
The above is the understanding of these concepts in Android, summed up the following:
The Android system is multi-process. But not the more the better, the process is too much, the system will die
One app per launch. The system will open a new process for it, in general, the four components of this app are executed in the same process, and the same thread
Assume that the process of configuring the component in the Mainifest.xml file (: XXX is a system-wide, global, shared processes. XXX is a common process for the current app). Then the component can be executed independently in a separate process
So, there is the Aidl technology. Communication between processes
Aidl is an interface-descriptive narrative language that can also be understood as an interface between Java processes (interface)
Write a Java interface class directly, and then change the suffix to. Aidl after compiling, a Java class is generated under the Gen folder. And there is an abstract class in this class. This abstract class is implemented on the server side and returned to the client through the Onbind method. You can use this object in the client process to invoke the methods in the server-side process. Achieve communication
It can be seen that aidl technology is virtually identical to the way the binding service is used, but that the binding service defines the interface through a Java file, and aidl is defined by the Aidl file. and after testing. Of course, the same process can be used aidl, that is to say. Bind service can be replaced by aidl
Next service:
The binding service, called by the Bundservcie method. Onbundservice is deactivated, and when the caller destroys, for example, a call in an activity. When this aictivity is destroyed, the service is destroyed.
Global Services. By StartService method Invocation, StopService is deactivated and when the caller destroys it. This service is still being executed and is only destroyed when the app is exited. Of course, the ability to keep some of the services executing through daemon technology
These are just personal understandings. If there is any mistake, please help to instruct twos
Understanding of Android threads, processes, components, apps