【问题标题】:How to set notification channel when sending messages via rest api?通过rest api发送消息时如何设置通知通道?
【发布时间】:2019-02-03 22:18:16
【问题描述】:

我一直在我的 android 应用中实现通知通道以支持最新的 android 版本。

您可以在从 Firebase Web 控制台发送消息时设置通知通道 id,但我无法找到通过 fcm rest api 发送消息时如何设置通道 id。

参考资料(https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages)中没有提到通知渠道,但我很确定一定有办法设置渠道ID。

【问题讨论】:

  • 为了做到这一点,您必须了解上面链接中给出的步骤。
  • 我已经在使用其余的 api 来发送消息,这没有问题。只是在寻找将频道 ID 放入的键/字段......还是我错过了一些概念上的东西?
  • 也许您可以从以前的活动中获取频道 ID?

标签: firebase firebase-cloud-messaging notification-channel


【解决方案1】:

我缺少的键名是 android_channel_id

我在 Legacy HTTP 服务器协议文档 (https://firebase.google.com/docs/cloud-messaging/http-server-ref) 中找到了密钥名称

【讨论】:

  • 谢谢亲爱的,但这个解决方案对我不起作用。再次感谢。
  • 仅供参考,实际发送消息时,参数名称需要为“channel_id”:示例:android:{notification:{title:title,body:message,channel_id:'high_importance_channel'}},
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-09-08
  • 2017-07-04
  • 1970-01-01
  • 2016-12-08
  • 2018-01-18
  • 1970-01-01
相关资源
最近更新 更多