Firebase 云消息传递 click_action 格式是特定于平台的吗? [英] Firebase Cloud Messaging click_action format is platform specific?

查看:17
本文介绍了Firebase 云消息传递 click_action 格式是特定于平台的吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Firebase Cloud Messaging 向我的应用程序的客户端发送通知.客户端可以是三个支持的平台(ios、android、web)中的任何一个.

I am using Firebase Cloud Messaging to send notifications to clients of my app. The clients can be any of the three supported platforms (ios, android, web).

我希望用户能够点击通知来启动应用程序.
为此,我必须在通知中指定 click_action.对于 ios 和 android 这似乎是一个简单的字符串.对于网络,它将是一个 url.

I want the user to be able to click on the notification to launch the app.
For this i have to specify a click_action in the notification. For ios and android that seems to be a simple string. For web it would be an url.

我应该如何发送适用于可能混合的一组设备的通知?

How am i supposed to send a notification that works for a potentially mixed set of devices?

我是否必须将设备分开并向它们发送不同的消息?

Do i have to separate the devices and send different messages to them?

推荐答案

FCM 基于设备生成的 ID 工作,这些 ID 因设备、平台和 curl 会话而异.因此,对于 Android、iOS 和 Web,它们会有所不同.如果要发送到所有平台,则必须调用该方法三次(每个平台一次),每次使用不同的有效负载或 curl 会话.我正在发送到具有两个不同功能的两个平台(iOS 和 Android)并同时调用它们.

FCM works based on IDs generated by devices which are different depending on the device, platform, and curl session. So, they would be different for Android, iOS and Web. If you want to send to all platforms, you have to call the method three times (once for each platform) with a different payload or curl session for each. I'm sending to two platforms (iOS and Android) with two different function and calling them at the same time.

这篇关于Firebase 云消息传递 click_action 格式是特定于平台的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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