0

Notification service extension is not triggered when notification is sent via firebase. It will show regular notification without image.

What is the exact payload I have to send.

I already tried this payload:

{ to = fedAu7oCO78:APA91bFAdcwctoVVcj-KtfQwD5hdBN7shcgw9QRgh-xQoLlKgBptqG2fxSYmL9T73BY5yOi81OOFbUVoZJp8b4hwPTCxvK4ZvR6hek, content_available = True, mutable_content = True, notification = { icon = myicon, badge = 1, sound = default, body = testing, title = iostest, NotificationImage = https://NotificationImage/822cf50ae5944995a033c51bf1c857a3banner1.jpg}, data = { mediaUrl = https://www.manijewel.com/NotificationImage/822cf50ae5944995a033c51bf1c857a3banner1.jpg }, 
priority = high, time_to_live = 6000 }

or

{
   "to": "dWB537Nz1GA:APA91bHIjJ5....",
   "data":
   {
      "message": "Offer!",
      "mediaUrl": "https://upload.wikimedia.org/wikipedia/commons/thumb/2/2a/FloorGoban.JPG/1024px-FloorGoban.JPG"
   },
   "notification":
   {
      "body": "Enter your message",
      "sound": "default",
      "content-available": 1,
      "mutable-content": 1
   }
}

And I get this:

I am using FCM for my project. It's have rich push notification for a type. I tried to modify most of possible ways to get push from FCM. I got only ordinary push from FCM, not with image.

I am also checking with APNS same coding using push try. I got what expected design for push notification.

Here on ios side payload

{
  "aps": {
     "alert": "Enter your message",
     "badge": 1,
     "sound": "default",
     "content-available": 1,
     "mutable-content": 1
  },
  "mediaUrl": "https://upload.wikimedia.org/wikipedia/commons/thumb/2/2a/FloorGoban.JPG/1024px-FloorGoban.JPG"
}

I use the pusher blog And

[1]: https://mobisoftinfotech.com/resources/mguide/ios-10-rich-notifications-tutorial/ to link rich media notification.Please help me how to sort this and where am i doing wrong.

thanx in advance

KENdi
  • 7,576
  • 2
  • 16
  • 31
Aashi
  • 170
  • 2
  • 14

1 Answers1

0

Payload format should be like below:-

{
       "to": "dWB537Nz1GA:APA91bHIjJ5....",
       "content_available": true,
       "mutable_content": true,
       "data":
       {
          "message": "Offer!",
          "mediaUrl": "https://upload.wikimedia.org/wikipedia/commons/thumb/2/2a/FloorGoban.JPG/1024px-FloorGoban.JPG"
       },
       "notification":
       {
          "body": "Enter your message",
          "sound": "default"
       }
}
Neha Gupta
  • 539
  • 3
  • 13
  • its a basic payload.m talking about rich media notification for ios 10. and for that mutable content and content available are necessary to trigger service extension – Aashi Jul 06 '17 at 08:54
  • Already tried but still service extension wont be triggered out mentioned – Aashi Jul 06 '17 at 10:27
  • Make sure you are using mutable_content and content_available instead of mutable-content and content-available in your FCM payload. – Neha Gupta Jul 06 '17 at 10:31
  • Yes it is that only...The p12 file that is uploaded on firebase console is of project.Do i have to replace it with extensions p12?@ Neha Gupta – Aashi Jul 06 '17 at 10:44
  • Please refer https://stackoverflow.com/questions/42693019/using-data-in-rich-push-notification-on-ios-with-fcm?rq=1 – Neha Gupta Jul 06 '17 at 10:46
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/148498/discussion-between-neha-gupta-and-asma-godil). – Neha Gupta Jul 06 '17 at 11:51