How to send iOS push notifications from my server using Firebase?

854 Views Asked by At

I'm writing a Java backend where I need to send push notifications to iOS devices. Note that I want to know how to configure my backend to send push payload to Firebase and it should then send it to iOS devices. I don't want to use direct Apple http/2 sockets because of some constraints. Could you point me to correct documentation of Firebase?

1

There are 1 best solutions below

0
On

Got the answer - We have to use REST APIs exposed by Firebase as follows -

Endpoint: https://fcm.googleapis.com/fcm/send

Body:

{  
  "notification" : {
     "title" : "You received simple notification!",
     "badge" : 1,   
     "sound" : "notification.wav",
     "body" : "This push was sent by FCM API",
     "custom" : {"key1":"value1","key2":"value2"},
     "priority":"high"
  },
  "content_available": false,
  "to":"FIREBASE_DEVICE_TOKEN"
}

Don't forget to add headers as follows -

Content-Type:application/json
Authorization:key=FIREBASE_SERVER_KEY

Don't forget to integrate iOS/Android SDK in your app in order to get the token and to get the push notification delivered!