Broadcast receiver registration A total of two forms: static registration and dynamic registration.
The difference between the two and their received broadcasts:
1. Dynamically registered broadcasts are always faster than statically registered broadcasts, regardless of the high priority setting of the static registration, regardless of how low the priority of the dynamic registration >\
2. Dynamic registration broadcasts are not resident broadcasts, which means that the broadcast follows the activity's life cycle. Note: Remove the broadcast receiver before the activity ends.
Static registration is permanent, that is, when the application is closed, if there is information broadcast, the program will be automatically run by the system call.
3. Under the same priority, who starts first, who will receive the broadcast first.
Dynamic Registration Code:
Updatebroadcast Newnew intentfilter ("Com.unit.UPDATE"); Registerreceiver ( Broadcast, filter);
Static registration code (added in config file):
<receiverAndroid:name= "Net.youmi.android.AdReceiver" > <Intent-filter> <ActionAndroid:name= "Android.intent.action.PACKAGE_ADDED" /> <DataAndroid:scheme= "Package" /> </Intent-filter> </receiver>
Android Notes (27) dynamic broadcast and static broadcast in Android