JSON iOS 9-10 静默推送通知的结构

JSON structure for an iOS 9-10 silent push notification

我们正在开发一个可以接收远程推送通知的应用程序。我们只知道有两种类型的通知,“正常”和无声。 我们想知道带有消息的静默通知的 JSON 结构。

{
"notification_type":2,
  "aps":
         {
             "alert":"Message de la notification", 
             "content-available":1,
            "badge":1,
             "sound":"default"
         }
}

对于静默推送通知,我们省略了 alertbadgesound(在静默推送中不使用)键,然后不显示通知,但处理程序叫做。 json 应如下所示:

{
  "aps":
         {
             "content-available":1,
         }
}

您也可以通过通知发送额外的内容,这样您的应用就会知道该怎么做:

{
  "aps":
         {
             "content-available":1,
         }
  "example-action": "example"
}