1

I need example of notification payload for silent notification, I tried this below structure, but it's not working

{ 
    "notification" : {
        "body" : " Survey list updated",
        "content-available:" : true,
        "data" : {
            "isNewUpdateAvailable" : "easysurvey.survey_list_updated"
            }
        },
        "to" : "f6PwToRUxk0:APA91bG7bSWoKsjHXVmXaiDEnFXA2x2jEOMSO6eGCqPv1fRd-dctNLDEabRq-0So_obuPGFqOFTSLJl5FFyuOuXKBXh-n89BmzzXenRTxoirY9Y1c6-J9MxpDp0ojHL2xm1law0V6gg3"
}

Using this structure, I am able to receive notifications, but it's not silent & doesn't wake the app. i need solution for firebase notification & on iOS 10, i am following same firebase sample code

Sheshnath
  • 3,293
  • 1
  • 32
  • 60
  • Possible duplicate of [Silent Push Notification Payload](http://stackoverflow.com/questions/36323903/silent-push-notification-payload) – Artem Novichkov Jan 10 '17 at 14:29
  • @ArtemNovichkov actually this question is regarding, FCM – Sheshnath Jan 10 '17 at 14:37
  • in android you have to use the "data" to receive apps in the background, otherwise you need to have the app in foreground. Don't know what ios is like – Saik Caskey Jan 10 '17 at 15:13
  • 1
    `content_available` is a top level field, so make it a sibling of the notification payload. – Arthur Thompson Jan 10 '17 at 22:05
  • @sheshnath Hi. Do post relevant code snippets. Not entirely familiar with the changes for iOS 10. Have you seen the notes specific for iOS 10 in the [docs](https://firebase.google.com/docs/cloud-messaging/ios/client)? – AL. Jan 11 '17 at 09:15
  • @AL. just for additional information i mentioned iOS 10, even i don't know any specific for iOS 10 – Sheshnath Jan 11 '17 at 09:25
  • Sorry. What I meant was there are some specific notes in the documentation intended for iOS 10 implementations. Have you gone through them before? – AL. Jan 11 '17 at 09:48
  • No as of now, going through it now – Sheshnath Jan 11 '17 at 09:50

1 Answers1

5

i got the answer, write payload structure in this way.

{  
   "data":{  
      "title":"mytitle",
      "body":"mybody",
      "url":"myurl"
   },
   "notification":{  
      "title":"mytitle",
      "body":"mybody",
      "content_available": true
   },
   "to":"DEVICE_FCM_TOKEN"
}

this may help someone. if you wish to test FCM notification using POSTMAN Api client, use "key=YOUR_SERVER_KEY" enter image description here

Sheshnath
  • 3,293
  • 1
  • 32
  • 60