我使用Pusher创建了静音推送通知,该通知适用于JSON:
keytool -storepasswd -keystore my.keystore
这里重要的是内容 - 1可以获得它。
我现在的问题是在AeroGear UnifiedPush Server& Docker,但是当我构建我的JSON时,我无法放入那些密钥。
我尝试了这个没有成功:
{
"aps" : {
"content-available" : 1
},
"acme1" : "bar",
"acme2" : 42
}
它给我一个错误:
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
Documentation
如何使用AeroGear UnifiedPush服务器在iOS中发送推送通知?
答案 0 :(得分:0)
您应将 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 命令对其进行测试。