简体   繁体   中英

FCM silent push notification structure for iOS?

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

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" 在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM