BroadcastReceiver details, broadcastreceiver
StartBroadcastReceiverTwo steps are required:
IsBroadcastReceiverRegister the broadcast address, static registration (IntentFilter), Dynamic Registration (RegisterReceiver)
Static registration:
<receiver android:name=".MyReceiver"> <intent-filter> <action android:name="android.intent.action.MY_BROADCAST"/> <category android:name="android.intent.category.DEFAULT" /></intent-filter></receiver>
Dynamic Registration:
MyReceiver receiver = new MyReceiver(); IntentFilter filter = new IntentFilter(); filter.addAction("android.intent.action.MY_BROADCAST"); registerReceiver(receiver, filter);
UnregisterReceiver ()
Normal broadcast is completely asynchronous for multiple receivers. Generally, each receiver can receive the broadcast without waiting. The receiver does not affect each other. For such broadcast, the receiver cannot terminate the broadcast, that is, it cannot block the receiving actions of other receivers.
Terminate broadcast: abortBroadcast ()
Http://blog.csdn.net/liuhe688/article/details/6955668
SendOrderedBroadcast (intent, string) sends ordered broadcast:
Note: When the sendOrderedBroadcast method is used to send an ordered broadcast, a permission parameter is required. If it is null, the recipient is not required to declare the specified permission. If it is not null, it indicates that if the recipient wants to receive the broadcast, the specified permission must be declared.
The receiving system Broadcaset, for example, after "android. intent. action. BOOT_COMPLETED "," android. permission. ACCESS_NETWORK_STATE ", broadcast; then build and start the service Intent, new Intent (context, service. class); context. startService (intent); Start Service.
ContentResolver performs CRUD and other data operations on the specified Uri, but the Uri is not the real data core. Therefore, these CRUD operations will be delegated to the ContentProvider corresponding to the Uri.
In AndroidManifest. after the provider is configured in xml, when getContentResolver () in the Activity obtains the resolver, and then calls the query, insert, update and other methods through resolve, it actually calls the Provider to perform data operations.