标准广播
是一种异步广播,几乎所有注册监听这类广播的广播接收器都可以同时收到广播消息,效率比较高,无法截断。
有序广播
广播发出以后,高优先级的广播接收器可以优先接收到广播消息,并且做处理以后再发出广播消息,也可以对广播消息进行截断,那么低优先级的广播接收器将不能接收到广播消息。
动态注册
private IntentFilter intentFliter;
private NetWorkChangeReceiver networkChangeReceiver;
intentFliter.addAction("android.net.conn.CONNECtIVITY_CHANGE");
networkChangeReceiver = new NetWorkChangeReceiver();
registerReceiver(netWorkChangeReceiver, intentFliter);
@override
protected void onDestroy(){
super.onDestroy();
unregisterReceiver(networkChangeReceiver);
}
class NetWorkChangeReceiver extends BroadcastReceiver {
@override
public void onReceiver(Context context, Intent intent){
}
}