iosswiftpush-notificationfirebase-cloud-messagingrich-media

Firebase not displaying rich push notification


I am using firebase notification in my application. I want to send rich notification but firebase console don't have UI for same. So I am trying to send the payload using postman.

I have created Notification Service Extension for handling content but it never gets called.

Deployment target in xCode is iOS 10.0 and iPad has iOS 11

Json payload(Not Working):

  {
    "to":"/topics/dev_news",
   "mutable_content": true,
   "data":
   {
        "attachment-url":"my image url",
        "media_type":"image"

   }

}

FYI: I am able to receive push if I add "notification" key-value in payload.

Json payload(Working but without media):

{
    "to":"/topics/dev_news",
   "mutable_content": true,
   "data":
   {
        "attachment-url":"my image url",
        "media_type":"image"

   },
   "notification" : {
    "title" : "demo push",
    "body" : "this is push body"
   }

}     

Any idea about this??


Solution

  • Answering to my own question, I was searching for attachment-url in data dictionary (which I was passing in the payload) in service extension class. But attachment-url comes directly in the content.userInfo (It is not wrapped inside the data dictionary) in extension class.

    Wondering how I can make such a silly mistake..!! :D