Android的GCM:如何检测规范注册的ID在我自己的服务器? [英] Android GCM: How to detect registered canonical ids in my own server?

查看:183
本文介绍了Android的GCM:如何检测规范注册的ID在我自己的服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Play商店发布的应用。
当我想要发送通知,一些用户(如我)收到重复的消息。
我知道我必须处理它,当我发送邮件收回规范ID和更新旧的注册ID。但是,我能做些什么来解决这个情况不发送任何通知?

I have an app published at the play store. When I want to send a notification, some users (for example, me) receive duplicate messages. I know that I have to handle it when I send the messages to recover the canonical ids and update the old registered id. But, Can I do something to fix this situation without sending any notification?

推荐答案

您应该想出一个办法,通知您的服务器时,GCM会将您的应用一个新的注册ID。

You should figure out a way to notify your server when GCM sends your app a new registration id.

目前,当你从GCM注册ID,将它发送到您的服务器,这可能将其添加到您的数据库没有检查,如果这个ID应该取代旧标识。

Currently when you get a registration id from GCM, you send it to your server, which probably adds it to your DB without checking if that id should replace an old id.

为了检测这种情况下,并更新旧的标识,而不是PF插入一个新的,你应该自己唯一的ID分配给每个应用程序实例,并将其发送给服务器使用reg ID一起。你应该坚持外部存储该ID,所以,如果您的应用程序卸载,然后重新安装甚至生存。

In order to detect that case, and update the old id instead pf inserting a new one, you should assign your own unique id to each app instance, and send it to the server along with the reg id. You should persist that id in external storage, so that it survive even if your app is uninstalled and then installed again.

这篇关于Android的GCM:如何检测规范注册的ID在我自己的服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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