在Android的设备GCM注册问题 [英] Gcm device registration issue in android

查看:151
本文介绍了在Android的设备GCM注册问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我与推送通知在android.its工作fine.but我的问题是工作我得到多个通知,而不是一个单一的notification.then检查我的设备登记表,发现一个奇怪的事实,每次30分钟我的设备后, ID是变化的,所以多个设备都抵制相同user_ID的和得到的通知号码一起。我不知道为什么会这样发生的事实我使用三星Galaxy S2进行测试。请帮助我。

Currently i am working with push notification in android.its working fine.but my issues is am getting multiple notification instead of a single notification.then i check my device registration table and find a strange fact ,after each 30 minutes my device id is changing,so multiple device are resisted for same user_id and getting number of notification together .i don't know why this happen.i am using Samsung galaxy s2 for testing. please help me .

推荐答案

我不知道为什么你的注册ID,每30分钟发生变化。或许,如果你发布你的注册code我就可以告诉。
不论该问题,您的服务器应该能够处理多个注册同一设备。当您发送的注册ID为您的服务器,发送它通过您的应用程序或服务器创建了另一个唯一的ID,这将让你当你得到一个新的注册ID为现有设备识别,在这种情况下,你会用新的取代旧的注册ID。

I'm not sure why your registration id changes every 30 minutes. Perhaps if you post your registration code I'll be able to tell. Regardless to that issue, your server should be able to handle multiple registrations for the same device. When you send the registration id to your server, send with it another unique id created by your app or by your server, and that would allow you to identify when you get a new registration id for an existing device, in which case you'll replace the old registration id with the new one.

您应该在服务器上做的另一件事是处理情况,GCM服务器返回一个规范的注册ID的情况下,在这种情况下,你应该代替你用来与规范1发送消息的ID。

Another thing you should do at the server is handle the case where gcm server returns a canonical registration id, in which case you should replace the id you used for sending the message with the canonical one.

这篇关于在Android的设备GCM注册问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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