在谷歌云消息泄露IntentReceiver [英] Leaked IntentReceiver in Google Cloud Messaging

查看:122
本文介绍了在谷歌云消息泄露IntentReceiver的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序实现的GCM,我使用 GSMRegistrar 这里建议。不,我凑logcat中的错误

I have implemented GCM in my app and I am using GSMRegistrar as suggested here. No I am getting an error in 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()?

我可以从这个理解并着眼于$ C $下 GSMRegistrar 是我需要调​​用 GSMRegistrar.onDestroy(本) ,但我不明白,我应该叫这个?在的onDestroy调用()活动 MNP 会导致它停止重试的 GSM Registartion

What I can understand from this and looking at the code for GSMRegistrar is I need to to call GSMRegistrar.onDestroy(this) but I could not understand where should I call this? Calling in onDestroy() of activity mnp causes it to stop retrying for GSM Registartion

推荐答案

您可以使用,而不是活动场景的应用程序上下文。这样退避机构不被活动的生命周期的限制。

You may use the application context, instead of the activity context. That way the backoff mechanism is not restricted by the activity life cycle.

这篇关于在谷歌云消息泄露IntentReceiver的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆