在哪里可以找到Firebase Cloud Messaging的Reference_Ids? [英] Where to find Reference_Ids for Firebase Cloud Messaging?

查看:116
本文介绍了在哪里可以找到Firebase Cloud Messaging的Reference_Ids?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

经过大量的阅读和谷歌搜索,似乎我已经完成了谷歌云消息传送发送推送通知的设置。我缺少的链接是我必须用来定位应用的 Reference_Ids 。我创建了一个项目,并添加了我的应用程序。



当我向GCM发送一个推送请求时,我收到以下回应:

  {multicast_id:7952352701122753715,success:0,failure:1,canonical_ids:0,results:[{error :InvalidRegistration}]} 
StatusCode:200,ReasonPhrase:'OK',版本:1.1,内容:System.Net.Http.StreamContent,标题:
{
X-Content -Type-Options:nosniff
X-Frame-Options:SAMEORIGIN
X-XSS-Protection:1; mode = block
Alt-Svc:quic =:443; MA = 2592000; v =35,34
Vary:Accept-Encoding
Transfer-Encoding:chunked
Accept-Ranges:none
Cache-Control:max-age = 0,private
日期:2016年12月21日星期三16:12:43 GMT
服务器:GSE
内容类型:application / json; charset = UTF-8
过期时间:2016年12月21日星期三16:12:43 GMT
}

错误读取为InvalidRegistration

所以我的问题是:


  • 在哪里可以找到我的注册ID?

  • 作为相关的后续问题,我在哪里可以找到Registration_Ids应用程序或特定的组或用户?



BTW:我找到一个相关的问题,但它似乎没有答案在哪里找到这些ID。 StackOverflow post

解决方案

InvalidRegistration 意味着你使用的注册标记(注册标识)是无效的(不存在,错误的格式):


检查您传递给服务器的注册令牌的格式。确保它与客户端应用程序从注册Firebase通知时收到的注册令牌相匹配。请勿截断或添加其他字符。


确保您要使用正确且相应的注册令牌给您要发送的设备消息来。对于测试,我建议您也使用 Firebase控制台,以便查看是否这个错误仍然会发生。



对于Android,您可以检索注册令牌

  FirebaseInstanceID.getToken()

然后,您可以选择将令牌存储到您的应用程序服务器。


After a lot of reading and Googling it seems I have made a complete setup for Google Cloud Messaging to send push-notifications. My missing link is the Reference_Ids that I must use to target apps. I have created a project and also added my apps to it.

When I send a push-request to GCM I get the following response:

{"multicast_id":7952352701122753715,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"InvalidRegistration"}]}
    StatusCode: 200, ReasonPhrase: 'OK', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
    {
      X-Content-Type-Options: nosniff
      X-Frame-Options: SAMEORIGIN
      X-XSS-Protection: 1; mode=block
      Alt-Svc: quic=":443"; ma=2592000; v="35,34"
      Vary: Accept-Encoding
      Transfer-Encoding: chunked
      Accept-Ranges: none
      Cache-Control: max-age=0, private
      Date: Wed, 21 Dec 2016 16:12:43 GMT
      Server: GSE
      Content-Type: application/json; charset=UTF-8
      Expires: Wed, 21 Dec 2016 16:12:43 GMT
    }

And the error reads "InvalidRegistration".

So my questions are:

  • Where do I find my registration Ids?
  • And as a related follow-up question, where do I find Registration_Ids for everyone using an app or a specific group or user?

BTW: I found a related question, but it does not seem to have an answer to as where to find these Ids. StackOverflow post.

解决方案

InvalidRegistration means that the registration token (registration id) you used is invalid (doesn't exist, wrong format):

Check the format of the registration token you pass to the server. Make sure it matches the registration token the client app receives from registering with Firebase Notifications. Do not truncate or add additional characters.

Make sure that you are using the correct and corresponding registration token to the device you intend to send the message to. For testing, I would suggest to make use of the Firebase Console too, so that you can see if the error still occurs from there.

For Android, you can retrieve the registration token by calling:

FirebaseInstanceID.getToken()

You may then choose to store the token to your App Server.

这篇关于在哪里可以找到Firebase Cloud Messaging的Reference_Ids?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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