在应用程序开始后收到奇怪的推送消息 [英] Weird push message received on app start

查看:107
本文介绍了在应用程序开始后收到奇怪的推送消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到我的推送服务抓获一个奇怪的推送消息:

I'm getting a weird push message captured by my push service:

Bundle[{CMD=RST_FULL, from=google.com/iid, android.support.content.wakelockid=1}]

刚开始昨天发生,我真的不能发现其中code的变化是应该为此负责。有没有人见过这个消息之前,也许知道它在哪儿来自哪里,为什么?

Just started to happen yesterday and I can't really spot which code change is to blame for this. Has anyone seen this message before and maybe knows where is it coming from and why?

推荐答案

您的应用程序是得到这个消息,因为它不得不从备份中恢复数据。由于备份可能包括注册标记,该广播发送告诉你的应用程序,以获得新令牌,备份的人将无法正常工作。

Your app is getting this message because it has had data restored from a backup. As the backup may have included registration tokens, this broadcast is sent telling your app to get new tokens as the backed up ones will not work.

这是为新的 GCM的API 的,它会导致你的InstanceIdListenerService实现的onTokenRefresh()被调用的方法,在您的应用程序应该重新获取所有的标记。

This is intended for the new GCM APIs, and it will cause your InstanceIdListenerService implementation's onTokenRefresh() method to be called, where your app should obtain all its tokens again.

不幸的是,如果你正在写自己的BroadcastReceiver,这些消息将是意想不到的,可能会导致您的应用程序崩溃。正确的做法是在从字段进行筛选,如果你看到这些消息之一,与GCM重新注册为您的令牌可能是无效的。

Unfortunately, if you are writing your own BroadcastReceiver, these messages will be unexpected and may cause your app to crash. The right thing to do is to filter on the "from" field, and if you see one of these messages, to register again with GCM as your tokens may be invalid.

如果你得到了一个新的情况外,这些消息安装你的应用程序的数据正在恢复的地方,请邮寄到的 Android的GCM 的邮件列表。

If you are getting these messages outside the situation of a fresh install where your app's data is being restored, please post to the android-gcm mailing list.

这篇关于在应用程序开始后收到奇怪的推送消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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