How to send firebase push notification

POST-URL : - https://fcm.googleapis.com/fcm/send
header : -

Content-Type: application/json
Authorization:key= AIzaSy*************************3SY(Server key from Google Play Console )

//Send To Single Device : -
body : -
{
  "data": {
    "image": "https://lh3.googleusercontent.com/-joANfM24rjU/AAAAAAAAAAI/AAAAAAAAACI/wTOiaSlKeDw/s60-p-rw-no-il/photo.jpg",
    "message": "Hello,Push Notification",
    "AnotherActivity": "True"
  },
  "to": "dKq******kM:APA91bFU9Y-NCKguMBOv_qvrAv***************************************************************SLmUwNl1yCRwTrQsRVPNAhh7O3UpzgWKQnKI9GIcDRnUM8X"
}

//Send To All Devices : -
In Android Studio :-
FirebaseMessaging.getInstance().subscribeToTopic("all");

body :-
{ "data": {
    "image": "https://lh3.googleusercontent.com/-joANfM24rjU/AAAAAAAAAAI/AAAAAAAAACI/wTOiaSlKeDw/s60-p-rw-no-il/photo.jpg",
    "message": "Firebase Push Message Using API"
    "AnotherActivity": "True"
  },
  "to" : "/topics/all"
}

Comments

Popular posts from this blog

How to Fix ‘This file name is too long’ Error?

Library To Load Html Content In Android TextView in Android