Firebase Cloud Messaging - Send message to all users

前端 未结 2 1040
故里飘歌
故里飘歌 2020-11-30 14:31

I\'m new using the Firebase Cloud Message. I built an IOS app to receive push notifications. The app works fine. I send messages from the Firebase console and they\'re displ

相关标签:
2条回答
  • 2020-11-30 15:32

    You can make use of topics. Given that all of your users are subscribed to a specific one. Just like what I mentioned here (removed some parts, just check them out if you want):

    If you are looking for a payload parameter to specify that you intend the message for all your users, unfortunately, it doesn't exist.

    Commonly, when sending notifications to multiple users, you can make use of the registration_ids parameter instead of to. However, it only has a maximum of 1000 registration tokens allowed. If you intend to use this, you can make batch requests of 1000 registration tokens each, iterating over all the registration tokens you've stored in your app server.

    However, do keep in mind that Diagnostics for messages sent to Topics are not supported.

    0 讨论(0)
  • 2020-11-30 15:33

    I found this:

    !('TopicA' in topics)
    

    With this expression, any app instances that are not subscribed to TopicA, including app instances that are not subscribed to any topic, receive the message.

    So you could probably use

    condition="!('nonExistingTopic' in topics)"
    
    0 讨论(0)
提交回复
热议问题