机器人C2DM:重复消息以相同的设备和应用程序 [英] Android C2DM : Duplicate message to the same device and App

查看:120
本文介绍了机器人C2DM:重复消息以相同的设备和应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道是否有人曾与谷歌C2DM 面对这个问题?这是我面临的情况:

I'm wondering if anyone has faced this issue with Google C2DM? This is the scenario I am faced with:

  1. 在用户安装应用程序和寄存器 与C2DM服务器对一个登记 关键的。
  2. 用户卸载应用程序。
  3. 用户重新安装应用程序(和 与C2DM服务器新注册 注册键)。
  1. User installs the app and registers with C2DM server for a registration key.
  2. User uninstalls the app.
  3. User reinstalls the app (and registers with C2DM server for new registration key).

现在我发短信从我的服务器到用户的手机,他们得到重复的消息。

Now I send message from my server to the user's phone and they get a duplicate message.

任何人都可以摆脱任何见解阉这是预期的行为或者我怎么能解决这个问题? 谢谢你,

Could anyone shed any insight into wether this is expected behaviour or how I can fix it? Thanks,

推荐答案

不知道这是最好的方法,但有一个相关的的超过在的Andr​​oid C2DM 组,这里的海报提供了一个方法:

Not sure if this is the best approach, but there's a relevant thread over at the android-c2dm group, where the poster offers one technique:

我发送注册ID的邮件中,这样我就可以检查对设备上存储的注册ID。

I am sending registration id in the message, so I can check it against the stored registration id on the device.

如果它是不一样的,丢弃它并通知注册ID不再使用的服务

If it's not the same, discard it and notify the service that registration Id is no longer in use

缺点是发送注册ID占用一些空间,已   限制邮件大小。但是,完全在我的情况,因为我   原始消息是不超过几个字符长更多。

Downside is sending registration Id takes up some space in already limited message size. But works perfectly in my case since my original message is no more than a few chars long.

这篇关于机器人C2DM:重复消息以相同的设备和应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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