If you want to send push notification from your server using the firebase console, first you can check it is working or not in Postman. you have entered this Url ( https://fcm.googleapis.com/fcm/send), then add the headers to it.
1 Content-Type application/json
2 Authorization key=your server key or legacy key. For more information check the screenshot
There two ways to send the push notification
Note:-
1 Send to a single user. you have to add this content to the body.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
{ "to" : "your key / instance id / device token generated by the firebase", "notification" : { "body" : "great match!", "title" : "Portugal vs. Denmark" "content_available" : true, "priority" : "high", }, "data" : { "body" : "great match!", "title" : "Portugal vs. Denmark" "content_available" : true, "priority" : "high", } } |
2 Send to a firebase topic. you have to add this content to the body.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
{ "to": "/topics/global", // global is your topic "notification" : { "body" : "great match!", "content_available" : true, "priority" : "high", "title" : "Portugal vs. Denmark" }, "data" : { "body" : "great match!", "content_available" : true, "priority" : "high", "title" : "Portugal vs. Denmark" } } |
It is working fine at my side but in some android devices we are not getting notification.
please resolve my issues.