首页 > 解决方案 > 如何使用firebase在android中的通知中发送图像?

问题描述

我正在尝试从 firebase 控制台以推送通知的形式发送图像,但它不起作用,所以我尝试从邮递员发送,但它也不起作用。我在正文中尝试了来自 Internet 的其他参数,例如图标、图像、media_url、mediaImgUrl..等。

在这里帮助我,以便我可以在通知中发送图像。

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

标签: androidfirebasepush-notificationfirebase-cloud-messagingpostman

解决方案


尝试使用此有效负载发送图像:

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

推荐阅读