Broadcast receiver onReceive() never called

前端 未结 1 1107
天涯浪人
天涯浪人 2020-12-10 07:40

I get this issue in ICS, but not in previous versions:

From App1, I am sending broadcast and trying to receive it in App 2 activity. But the onReceive is never calle

相关标签:
1条回答
  • 2020-12-10 08:26

    In ICS you won't receive broadcasts until your app is started manually at least once.in Android 3.1+, apps are in a stopped state if they have never been run, or have been force stopped. The system excludes these apps from broadcast intents. They can be included by using the Intent.FLAG_INCLUDE_STOPPED_PACKAGES flag like this..

    i.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
    
    0 讨论(0)
提交回复
热议问题