Intent the receiving process:
1. Receiver Registration
I've already introduced this before.
Next take a look at the above two receive function, Schedulereceiver scheduleregisteredreceiver;
Schedulereceiver will fall into the Schedulereceiver function in Activitythread.java, Activitythread.java This is the subject of the target activity, then the function calls to the Handlemessage function in the file, which is called after receiving the receiver message Handlereceiver to deal with, this is an important function, the following analysis of a The processing of this function:
1, get this intent point to the component, including the package name, class name;
2, obtain the package information, this structure provides the getClassLoader interface;
3, by Java.lang.ClassLoader cl = Packageinfo.getclassloader get ClassLoader; 4, dynamically create a receiver,receiver = ( Broadcastreceiver) Cl.loadclass (component). newinstance (); 5, call Receiver.onreceive ( Context.getreceiverrestrictedcontext (), data.intent), into the real process of processing; 6, call Finishreceiver to trigger Activitymanagerservice this message to other receivers send or the next broadcast send;
The most important of these is the OnReceive function, which we usually implement and then process the messages we receive.
The logic of Scheduleregisteredreceiver
This function is actually for the way you use dynamic registration, which is how you invoke register registration in the code.
Summarize:
Intent from the point of view of use, is constructs the Intent, provides the appropriate parameters, such as the action, such as the data type, the data URI and so on, then sends out, the receiver needs to register a receiver, then provides the OnReceive function to be possible This registration can be simply written in the Androidmanifest.xml can also be done through the registerreceiver, when sent there are three APIs can be used: Sendbroadcast sendstickybroadcast Sendorderedbroadcast first for sending parallel broadcasts, the second for sending sticky broadcasts, and the third for sending serial broadcasts;