GCM 重复消息 [英] GCM duplicated messages

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

问题描述

我有一个基于 Google Cloud Messaging 的应用,并且运行良好.现在(今天)突然间它开始出现我们以前从未见过的问题.对于设备之间发送的每条消息,接收设备都会收到两次.第一个几乎立即到达(在发送后不到 3 秒内).第二个在几分钟后到达.测试中有两个设备,问题是相同的,无论是发送方/接收方.因此,如果一个设备向另一个设备发送了一些消息,另一个设备会立即收到它们——但稍后,它会收到一连串的消息,这些消息是它收到的消息的第二个副本.

我设置了断点以确保发送设备不是罪魁祸首:消息只发送了一次(即用于发送的 Web 服务只调用了一次——以及运行于后端的代码Google App Engine,多年来一直没有改变.)但是,消息以某种方式被传递到接收设备两次.通过使用断点,我还确保了我们自己在接收端的代码不负责任:经过验证,GCMIntentService::onMessage() 确实为每个发送的消息调用了两次.

我们还确保数据库中的注册 ID 是最新的.在这一点上,我很难过,需要一些想法来取得进一步的进展.那么有什么想法吗?

解决方案

https://groups.google.com/forum/#!topic/android-gcm/EHZUTEJMeyw

检查上面的官方 GCM 线程.每个人都在遇到这个问题.谷歌的错!

I have an app based on Google Cloud Messaging and it was working well. Now (today) all of a sudden it started having a problem we've never seen before. For each message sent between devices, the receiving device will get it twice. The first will arrive almost instantly (within less than 3 seconds of sending). The second arrives a few minutes later. There are two devices in the test, the problem is the same whichever one is the sender/receiver. So if a device sends a few message to the other, the other will get them pretty much instantly--but then at a later time, it will receive a barrage of messages which are the second copies of the messages it has received.

I have put in breakpoints to make sure that the sending device wasn't the culprit: the message was sent exactly once (i.e. the web service for sending was called exactly once--and the code for the backend, which runs on Google App Engine, hasn't changed for ages.) However, the message somehow gets delivered to the receiving device twice. By using breakpoints I also made sure our own code on receiving side isn't responsible: it is verified that GCMIntentService::onMessage() indeed gets invoked twice for each sent message.

We also made sure the registration id in our database is the latest. At this point I'm stumped and need ideas to make any further progress. So any ideas?

解决方案

https://groups.google.com/forum/#!topic/android-gcm/EHZUTEJMeyw

Check the official GCM thread above. Everyone is experiencing this issue. Google's fault!

这篇关于GCM 重复消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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