gpt4 book ai didi

android - Google Cloud Messaging 中泄露的 IntentReceiver

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

我已经在我的应用程序中实现了 GCM,我正在使用 GSMRegistrar按照建议here .不,我在 logcat 中收到错误

7-02 23:35:15.830: E/ActivityThread(10442): Activity com.abc.xyz.mnp has leaked IntentReceiver com.google.android.gcm.GCMBroadcastReceiver@44f8fb68 that was originally registered here. Are you missing a call to unregisterReceiver()?

我从中可以理解并查看 GSMRegistrar 的代码是我需要调用 GSMRegistrar.onDestroy(this) 但我不明白我应该在哪里叫这个?调用 Activity mnponDestroy() 会导致它停止重试 GSM Registartion

最佳答案

您可以使用应用程序上下文,而不是 Activity 上下文。这样退避机制就不受 Activity 生命周期的限制。

关于android - Google Cloud Messaging 中泄露的 IntentReceiver,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11299312/

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