hiashutoshsingh
hiashutoshsingh

Reputation: 1020

how to send image in notification in android using firebase?

I am trying to send image in push notification from firebase console but it doesn't work, so i tried to send from the postman but it doesn't work either. I tried other parameters like icon, image, media_url, mediaImgUrl..etc from Internet in the body.

Help me out here so that i can send image in notification.

{
       "to": "tokennnnnnnnnnnn............",
       "content_available": true,
       "mutable_content": true,
       "data":
       {
          "message": "Hey!",
          "icon": ".....farm.png"
       },
       "notification":
       {
          "body": "Topic",
          "sound": "default",
          "icon": ".....farm.png"
       }
    }

Upvotes: 0

Views: 3172

Answers (2)

S.lahiru
S.lahiru

Reputation: 111

{
 "to" : "FCM_TOKEN",
 "notification" : {
     "body" : "Body of Your Notification",
     "title": "Title of Your Notification",
      "image": "image url"
 }
}

Upvotes: 0

Karan Khurana
Karan Khurana

Reputation: 585

Try sending image with this payload :

{
  "message":{
    "token" : "bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1...",
     "android": {
       "notification": {
           "body" : "This is an FCM notification that displays an image.!",
           "title" : "FCM Notification",
           "image": "url-to-image"
       }
   }
}

Upvotes: 1

Related Questions