使用 Google API 接收到 Firebase 主题消息的状态

Firebase Topic Message Received Status using Google API(使用 Google API 接收到 Firebase 主题消息的状态)
本文介绍了使用 Google API 接收到 Firebase 主题消息的状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我在我的 APP 中集成了 Firebase 主题概念,订阅了近 2000 名用户,我每天都会通过我的应用服务器触发通知.

Recently, I integrated the Firebase Topic concept in my APP and near to 2K users was subscribed and I', triggering notifications daily via my app server.

我想知道有多少用户被交付并失败了.因为如果某些用户没有收到并失败,我将再次向这些成员设置重试通知.对此有何想法?

What I want to know is how many users are getting delivered and failed. Because if some users are not getting delivered and failed, I'll set a retry of the notification to those members again. Any ideas about this?

我还通过 ARC(高级 Rest 客户端)尝试了以下 URL,以使用以下 API 获取有关我当前项目中所有主题的信息:

I also tried the following URL via ARC (Advanced Rest Client) for getting the information about all my topics in my current project with following API:

https://iid.googleapis.com/iid/info/APA91bHQ3Jp2NPrVF7z_1a8qNgg_YGI-
zPhnxnpumCeckvieHACuwaIWPlaR....QcChUOhk4T62vAc_0PC8HVk4p4D?details=true

Content-Type: application/json
Authorization: key=<SERVER_KEY> 

SERVER_KEY ->(Firebase 控制台 -> 设置 -> Cloude 消息 -> 旧服务器密钥)

SERVER_KEY -> ( Firebase Console -> Settings -> Cloude message -> Legacy Server key )

但是我得到了响应状态:

But I am getting the response status:

400: Bad Request
{
"error": "InvalidTokenVersion"
}

有解决这个问题的办法吗?

Any idea to resolve this issue?

推荐答案

目前没有可用的 API 可用于在使用主题消息传递时跟踪设备是否已收到消息.

There is currently no available API that you can use in order to trace if a message has been received by the device when using Topics Messaging.

您必须以自己的方式以某种方式确认您的客户端应用程序已收到来自该主题的消息,如果它没有收到,则让您的应用程序服务器执行重试.

You'll have to implement your own way to somehow acknowledge that the message from the topic has been received by your client app, if it didn't receive it, then have your App Server do a retry.

附带说明,在使用 FCM 时,强烈建议使用服务器密钥而不是旧版服务器密钥.

On a side note, when using FCM, it is highly advised to make use of the Server Key instead of the Legacy Server Key.

关于 InvalidTokenVersion 响应.似乎与注册令牌有关.我最终尝试了它并能够复制响应,但仅在使用具有旧格式的注册令牌时(以 APA 开头,没有冒号:").

With regards to the InvalidTokenVersion response. It seems that it is related to the registration token. I tried it out on my end and was able to replicate the response, but only when using a registration token with the old format (starts with APA with no colon ":").

但是,当我使用新格式测试令牌时,它返回了预期的响应.我相当确定这与注册令牌有关.

But when I tested a token with the new format, it returned expected response. I'm fairly sure this has something to do with the registration token somehow.

这篇关于使用 Google API 接收到 Firebase 主题消息的状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

How to target newer versions in .gitlab-ci.yml using auto devops (java 11 instead of 8 and Android 31 instead of 29)(如何在.gitlab-ci.yml中使用自动开发工具(Java 11而不是8,Android 31而不是29)瞄准较新的版本)
Android + coreLibraryDesugaring: which Java 11 APIs can I expect to work?(Android+core LibraryDesugering:我可以期待哪些Java 11API能够工作?)
How to render something in an if statement React Native(如何在If语句中呈现某些内容Reaction Native)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)
Using Firebase Firestore in offline only mode(在仅脱机模式下使用Firebase FiRestore)
Crash on Google Play Pre-Launch Report: java.lang.NoSuchMethodError(Google Play发布前崩溃报告:java.lang.NoSuchMethodError)