Firebase Cloud Messaging click_action格式是否特定于平台? [英] Firebase Cloud Messaging click_action format is platform specific?

查看:64
本文介绍了Firebase Cloud Messaging 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 Cloud Messaging click_action格式是否特定于平台?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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