Firebase Cloud Messaging click_action format is platform specific?

假如想象 提交于 2019-12-01 06:05:51
android_jain

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.

Update: A recent feature was added for FCM that gives an option to provide specific params for specific platforms, called Platform Overrides.


Each platform may handle the same notification differently depending on your payload.

The click_action parameter is supported for all 3 platforms (Android, iOS, Web):

The action associated with a user click on the notification.

Each having different notes:

  • Android

    If specified, an activity with a matching intent filter is launched when a user clicks on the notification.

  • iOS

    Corresponds to category in the APNs payload.

  • Web

    For all URL values, secure HTTPS is required.

The note for Web doesn't say that you can only have URLs as it's value, just that IF it is a URL, it should have secure HTTPS (for security reasons).

It is okay to send a single notification for all platforms, so long as you are able to handle them accordingly and to you're liking. However, as also advised in the other answer, it is better for you to send different payloads depending on the platform.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!