【问题标题】:AeroGear: How to send silent push notification with AeroGear to iOS using AeroGear UnifiedPush Server?AeroGear:如何使用 AeroGear UnifiedPush 服务器向 iOS 发送带有 AeroGear 的静默推送通知?
【发布时间】:2018-06-14 15:10:13
【问题描述】:

我使用适用于该 JSON 的 Pusher 创建了静默推送通知:

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

它返回一个错误:

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

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

【问题讨论】:

    标签: ios push-notification apple-push-notifications aerogear


    【解决方案1】:

    您应该将 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 命令对其进行测试。

    【讨论】:

      猜你喜欢
      • 2015-07-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-03
      相关资源
      最近更新 更多