Android app not receiving Firebase Notification when app is stopped from multi-task tray

前端 未结 6 1309
长发绾君心
长发绾君心 2020-11-21 10:14

I have read a similar question on SO, however, I was not able to get the correct answer from it.

I have a system wherein we send notification to around 500 devices.<

6条回答
  •  無奈伤痛
    2020-11-21 10:22

    Answer was found here

    There are no way to send data message from notification console.

    But there are other way to send notification to devices and them will be catch inside onMessageReceived!

    You need can use terminal (Mac or Linux) or some service like Postman to send Post request on this link: https://fcm.googleapis.com/fcm/send

    with the next body:

    {
        "to": "/topics/your_topic_here",
       "data": {
           "text":"text",
           "text1":"text1",
           ...
       }
    }
    

    also you need to add 2 headers:

    1. Authorization - key=your_server_key_here
    2. Content-Type - application/json

    To get your server key, you can find it in the firebase console: Your project -> settings -> Project settings -> Cloud messaging -> Server Key

提交回复
热议问题