gpt4 book ai didi

android - BroadcastReceiver 在重启后延迟接收事件

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:08:15 24 4
gpt4 key购买 nike

我尝试使用下一个 BroadcastReceiver 接收 PHONE_STATE Intent

<receiver android:name=".CallReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.PHONE_STATE" />
<action android:name="android.intent.action.NEW_OUTGOING_CALL" />
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>

但是在重新启动我的 Nexus 5X 并调用此设备后,在一分钟前通话结束后可以接收到振铃事件。我该如何解决?有什么想法吗?

最佳答案

这是因为有其他Receiver在收听这个广播,你可以尝试提高你Recevier的优先级,就这样

<intent-filter android:priority="2147483647">  
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>

关于android - BroadcastReceiver 在重启后延迟接收事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41617332/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com