Firebase API does not send push notifications when using the API

I am switching from Parse to Firebase and am encountering a problem with our ios application. Firebase API does not send push notifications to ios app. This is what I send to https://fcm.googleapis.com/fcm/send

{ 
 "to: "<registration token>",
 "priority": "high",
 "data": {
     "customId": "<my custom id>",
     "badge": 1,
     "sound": "cheering.caf",
    "alert": "New data is available"
  }
}

And the server returns success

{
    "multicast_id":6917019914327105115,
    "success":1,
    "failure":0,
    "canonical_ids":0,
    "results":[{"message_id":"0:1468961966677585%f0f84693f9fd7ecd"}]
}

But the push is not delivered. If I sent a push using Firebase Dashboard, then the clicks will be delivered, even if I aim directly at the token.

I saw another developer complaining about another question. Stackoverflow Unable to send push notifications using the server API .

"": "" , . : push/sandbox push.

, Dashboard ios Development, API . ios, android API.

- push- API ?

+3
2

Firebase , .

{ 
 "to": "<registration token>",
 "priority": "high",
 "notification": {
    "title": "Your Title",
    "text": "Your Text"
  }
 "data": {
     "customId": "<my custom id>",
     "badge": 1,
     "sound": "cheering.caf",
    "alert": "New data is available"
  }
}

, -

+13

, https://fcm.googleapis.com/fcm/send API Firebase, :

{
  "notification":{
    "title":"Notification title",  //Any value
    "body":"Notification body",  //Any value
    "sound":"default", //If you want notification sound
    "click_action":"<activity_name>",  //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
}

, , .

+6

Source: https://habr.com/ru/post/1664694/


All Articles