Android BroadcastReceiver onReceive() called twice on android 4.0

前端 未结 15 2324
梦谈多话
梦谈多话 2020-12-29 20:38

I faced to one problem on android 4.0.3 (on 4.1.2 it works fine). I have in my Activity BroadcastReceiver. When I send a broadcast, method onReceive() called always twice. P

15条回答
  •  心在旅途
    2020-12-29 20:55

    You can avoid getting this problem, If you register your broadcast receiver from custom Application class. This will make sure that your broadcast receiver will be registered only once for the entire application life cycle.

提交回复
热议问题