Trying to have a Broadcast Receiver with No filter

 ̄綄美尐妖づ 提交于 2019-12-04 11:48:32

Because the BroadcastReceiver returns null when there is no match via the criteria from the IntentFilter, it is not possible with the API to accomplish what you hope to accomplish (which I'm assuming is sending any and all Broadcasts to mReceiver).

You can certainly specify an empty IntentFilter, but this will be pretty useless as registering the receiver won't cause it to catch any broadcasts (unless they are directly targeted to the receiver, as mentioned by MisterSquonk in the comments). Otherwise you must know exactly which broadcasts you want to catch with your BroadcastReceiver, then specify the criteria in the IntentFilter.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!