FCM rich push notification payload for iOS

前端 未结 2 432
無奈伤痛
無奈伤痛 2020-12-14 18:28

I am using FCM for my project. It\'s have rich push notification for a type. I tried to modified most of possible ways to get push from FCM. I got

相关标签:
2条回答
  • 2020-12-14 18:55

    This worked for me. The accepted answer seems to have some unnecessary information.

    {
      "to" : "devicekey OR /topics/sometopic",
      "mutable_content": true,
      "data": {
        "mymediavideo": "https://myserver.com/myvideo.mp4"
      },
      "notification": {
        "title": "my title",
        "subtitle": "my subtitle",
        "body": "some body"
      }
    }
    
    0 讨论(0)
  • 2020-12-14 19:06

    The mutable-content and content-available in your FCM payload is incorrect. It should be formatted as mutable_content and content_available. Both are boolean and must also be outside the notification parameter. Like so:

    {
       "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"
       }
    }
    

    For the counterpart of category in FCM, you should use click_action:

    The action associated with a user click on the notification.

    Corresponds to category in the APNs payload.

    0 讨论(0)
提交回复
热议问题