Android BroadcastReceiver without intent filters

前端 未结 2 2213
情深已故
情深已故 2021-02-19 20:28

I saw in few android ad networks sdks that they are declaring BroadcastReceiver with no intent filters. Something like this:



        
2条回答
  •  借酒劲吻你
    2021-02-19 21:30

    If you do not have some intent filters, the only way to receive something is to call the receiver explicitly. This would look like this:

    context.sendBroadcast(new Intent(context, MyBroadcastReceiverClass.class));
    

    Another guy already answered this question in the following post: https://stackoverflow.com/questions/10051256/broadcast-receiver-not-receiving

提交回复
热议问题