Android - How to use a local broadcast receiver?

前端 未结 1 532
伪装坚强ぢ
伪装坚强ぢ 2020-12-20 20:12

I\'m trying to use a local broadcast receiver.

In order to do so I\"ve done the next steps -

1) At an Activity, where Iwould like something to happen, I\'ve

相关标签:
1条回答
  • 2020-12-20 21:06

    You are using the LocalBroadcastManager to send the request, but you register the receiver on the "global" Intent. You should either use LocalBroadcastManager to register the receiver or send the broadcast on the application context:

    Step 2

    LocalBroadcastManager.getInstance(this).registerReceiver (receiver, filter);
    
    0 讨论(0)
提交回复
热议问题