AeroGear:如何使用 AeroGear UnifiedPush 服务器将带有 AeroGear 的静默推送通知发送到 iOS?

AeroGear: How to send silent push notification with AeroGear to iOS using AeroGear UnifiedPush Server?

我使用 Pusher 创建了静默推送通知 JSON:

{
    "aps" : {
        "content-available" : 1
    },
    "acme1" : "bar",
    "acme2" : 42
}

这里重要的是 1 可以获取的内容。

我现在的问题是在 AeroGear UnifiedPush Server & Docker 中使用它,但是当我构建我的 JSON 时,我无法放置该键。

我试过了没有成功:

curl -u "c94ab6da-17e1-4c35-b17f-1ab482152a65:57781ef0-9105-440d-b902-217461c0e743"     -v -H "Accept: application/json" -H "Content-type: application/json"     -X POST  -d   '{
     "message": {
      "alert": "Hello from the curl HTTP Sender!","content-available": true  
     }}'     http://localhost:18081/rest/sender

它 returns 我一个错误:

Unrecognized field "content-available" (class org.jboss.aerogear.unifiedpush.message.Message), not marked as ignorable

Documentation
如何使用 AeroGear UnifiedPush 服务器在 iOS 中发送推送通知?

您应该将 apns 对象添加到您的 JSON。完整的消息示例如下:

{
  "message": {
    "alert": "HELLO!",
    "sound": "default",
    "badge": 2,
    "consolidationKey": null,
    "priority": "normal",
    "windows": {
      "type": "tile",
      "duration": null,
      "badge": null,
      "tileType": "TileWideBlockAndText01",
      "toastType": null,
      "images": [
      ],
      "textFields": [
      ],
      "page": "/MainPage.xaml"
    },
    "apns": {
      "title": null,
      "action": null,
      "action-category": "some value",
      "url-args": null,
      "content-available": true,
      "mutable-content": false,
      "localized-key": null,
      "localized-arguments": null,
      "localized-title-key": null,
      "localized-title-arguments": null
    },

    "user-data": {
      "key2": "other value",
      "key": "value"
    },
    "simple-push": "version=123"
  },
  "criteria": {
    "categories": [
      "someCategories"
    ],
    "variants": [
      "someVariantIDs"
    ],
    "alias": [
      "someUsername"
    ],
    "deviceType": [
      "someDevice"
    ]
  },
  "config": {
    "ttl": 3360
  }
}

您可以使用 curl 命令对其进行测试。