I am trying to receive notifications from FCM automatically whenever data in the Firebase Database is changed. What I am hoping to do is to send a POST request to https://fcm.googleapis.com/fcm/send in the OnDataChange() method of Firebase Database. I also want the new value of the changed variable to be present in the notification. I have tested the POST request in Advanced Rest Client and it is working nicely. What I am looking for is to automate the process so that I do not need to create a server. I am new to Android so I am having a little trouble trying to implement this. It would be very helpful if someone could show me how to go about creating the POST request directly in Android in the format below with the flexibility of being able to change the value of the notification text and body. 
Headers
Authorization: key=AAAA4wkL01w:APA91bHu... //Server Key
Content-type: application/json
Body
{
"to": "eGS6QMzVlbA:APA91bFtY...", //Token
"notification": {
"title": "title",
"body": "body text",
"icon": "ic_notification"
}
}
 
    