Firebase API is not sending push notifications when using the API

前端 未结 2 2077
無奈伤痛
無奈伤痛 2020-12-06 13:16

I\'m migrating from Parse to Firebase and facing a problem with our ios app. The Firebase API does not send push notifications to the ios app. This is what im sending to htt

2条回答
  •  长情又很酷
    2020-12-06 13:32

    The object you send to https://fcm.googleapis.com/fcm/send with Firebase API should look like this :

    {
      "notification":{
        "title":"Notification title",  //Any value
        "body":"Notification body",  //Any value
        "sound":"default", //If you want notification sound
        "click_action":"",  //Must be present for Android
        "icon":"fcm_push_icon"  //White icon Android resource
      },
      "data":{
        "param1":"value1",  //Any data to be retrieved in the notification callback
        "param2":"value2"
      },
        "to":"/topics/topicExample", //Topic or single device
        "priority":"high", //If not set, notification won't be delivered on completely closed iOS app
        "restricted_package_name":"" //Optional. Set for application filtering
    }
    

    Please if your problem has been solved don't forget to mark it as such.

提交回复
热议问题