Android GCM“未注册”尽管getRegistrationId返回一个ID [英] Android GCM "Not registered" though getRegistrationId returns an ID

查看:183
本文介绍了Android GCM“未注册”尽管getRegistrationId返回一个ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在多个Android设备上使用GCM。我们能够使用GCM通知的一些设备(并非全部)最近未能收到GCM触发器(GCM服务器返回未注册)。然而,当我们在设备上调用getRegistrationId()函数时,我们会得到相同的注册ID。



p>任何想法为什么服务器在客户端返回实际ID时未返回注册?

解决方案

NotRegistered 由GCM返回,如果



  • 如果客户端应用程序取消注册GCM。

  • 如果客户端应用程序自动取消注册,用户卸载该应用程序。例如,在iOS上,如果APNS反馈服务报告APNS令牌无效。

  • 如果注册令牌到期(例如,Google可能决定刷新注册令牌或APNS令牌已过期的iOS设备)。

  • 如果客户端应用程序已更新,但新版本未配置为接收消息。


这个标记不应该再次使用。



在设备端,您应该调用InstanceID.getToken以获得新的令牌,然后将此新令牌发送到您的服务器,以便将消息发送到应用程序。



好像您正在使用传统注册ID 将消息发送到您的设备。如果是这样,您应该切换到使用 InstanceID令牌将消息发送到设备。


We use GCM with multiple Android devices. A few devices (not all) which we were able to notify using GCM, are recently failing to receive the GCM trigger (GCM server returns not registered).

However, when we call getRegistrationId() on the device we get the same registration ID when it was functional.

Any idea why the server is returning not registered while the client is returning an actual ID?

解决方案

NotRegistered is returned by GCM if

  • If the client app unregisters with GCM.
  • If the client app is automatically unregistered, which can happen if the user uninstalls the application. For example, on iOS, if the APNS Feedback Service reported the APNS token as invalid.
  • If the registration token expires (for example, Google might decide to refresh registration tokens, or the APNS token has expired for iOS devices).
  • If the client app is updated but the new version is not configured to receive messages.

This token should not be used again.

On the device side you should be calling InstanceID.getToken to get a new token, then send this new token to your server for sending messages to the app.

Seems like you are using legacy reg ids to send messages to your device. If so you should switch to using InstanceID tokens to send messages to the device.

这篇关于Android GCM“未注册”尽管getRegistrationId返回一个ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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