Where to find Reference_Ids for Firebase Cloud Messaging?(在哪里可以找到 Firebase 云消息传递的 Reference_Id?)
问题描述
经过大量阅读和谷歌搜索后,我似乎已经为 Google Cloud Messaging 完成了发送推送通知的设置.我缺少的链接是我必须用来定位应用程序的 Reference_Ids.我创建了一个项目并将我的应用程序添加到其中.
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.
当我向 GCM 发送推送请求时,我收到以下响应:
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
}
错误显示为InvalidRegistration".
所以我的问题是:
- 在哪里可以找到我的注册 ID?
- 作为一个相关的后续问题,我在哪里可以找到每个使用应用或特定组或用户的 Registration_Id?
顺便说一句:我找到了一个相关的问题,但似乎没有关于在哪里可以找到这些 ID 的答案.StackOverflow 帖子.
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 表示你使用的注册令牌(registration id)无效(不存在,格式错误):
InvalidRegistration means that the registration token (registration id) you used is invalid (doesn't exist, wrong format):
检查您传递给服务器的注册令牌的格式.确保它与客户端应用通过 Firebase 通知注册收到的注册令牌相匹配.不要截断或添加其他字符.
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.
确保您使用正确且对应的注册令牌到您打算向其发送消息的设备.对于测试,我建议也使用 Firebase 控制台,以便您查看是否错误仍然从那里发生.
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.
对于 Android,您可以 通过调用检索注册令牌:
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 云消息传递的 Reference_Id?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在哪里可以找到 Firebase 云消息传递的 Reference_Id?
基础教程推荐
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01