SwathiK
SwathiK

Reputation: 364

How to show image in iOS Push Notification Banner using FireBase SDK

In iOS using firebase push notification i cannot see the image on push notification

this is the format i am using to send notification. I can see the notification but not the image

{
  "content_available": true,
  "data": {
    "actionId": "219CE497-1FAC-4974-B605-F28B87E756AB",
    "actionName": "display",
    "actionType": "Movie",
    "attachment-url": "http://singteltv.com.sg/_channels/pic_ch1.jpg",
    "dataId": "123fcm-20180327",
    "dataMessage": "test Swathi: !#@$%^&*' 中文 - ไทย 1234567890 1234567891  1234567892  1234567893  1234567894  1234567895",
    "dataTitle": "test Title",
    "media_type": "image"
  },
  "mutable_content": true,
  "notification": {
    "body": "test Swathi: !#@$%^&*' 中文 - ไทย 1234567890 1234567891  1234567892  1234567893  1234567894  1234567895",
    "sound": "default",
    "title": "test Title"
  },
  "to": "cbBGCiyqpVw:APA91bHhAn0xXW8GiixQFmE5pcSpOPYjRRSABrDqR9AWhpMOHqGbRqd25Jrd3rLIOakXuIzGS81vG_QBotlC3fidjkYZmfBsu3iDxJJVYG3uB8bPi1zxXluIpZzU8yWHdnk2vWu00AVn"
}

Upvotes: 1

Views: 8552

Answers (1)

user7219266
user7219266

Reputation:

You have to create a Notification Service Extension in order to download the image before display it.

It's like a service running in background that will allow you to modify the content of the notification before display it to the user.

You can also create a Notification Content Extension that can allow you to display Rich Notification by 3D touching the notification.

Anyway you are almost there, check this great article, it will help you.

Service Extension

Attachment Notification

You can also use Postman to make real-case request, it is a great tool for testing.

I hope it will help you, feel free to ask more information if you are still stuck.

Upvotes: 1

Related Questions