应用启动时收到奇怪的推送消息 [英] Weird push message received on app start

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

问题描述

我的推送服务捕获到一条奇怪的推送消息:

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}]

昨天才开始发生,我无法真正发现是哪个代码更改造成的.有没有人以前看过这条消息,也许知道它来自哪里以及为什么?

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天全站免登陆