BlueMix Push Notification - support for Apple localized alert messages

こ雲淡風輕ζ 提交于 2019-12-11 10:49:21

问题


Using IBM Bluemix push notification service, is it possible to send a push notification using Apple's loc-key and loc-args fields? If so, how can you construct such a request using the REST API? The documentation does not mention the availability of these fields.


回答1:


So after testing out a few things with the REST API it does not appear to currently support any aps or gcm specific fields for the "alert" value. I would say this is likely due to simplifying things to support both platforms.

The closest you can probably get right now utilizing the REST API would be to input your loc-key and loc-args values into the customer payload and then extract them in your client-side code.

So for example on the REST side of things your request might look like

{
  "message": {
    "alert": "Silent Alert, Extract Payload"
  },
  "settings": {
    "apns": {
      "type": "SILENT",
      "payload": {
        "loc-key" : "GAME_PLAY_REQUEST_FORMAT",
        "loc-args" : [ "Jenna", "Frank" ]
      }
    }
  }
}

Which would send the notification and the payload but not alert the user at which point you could extract the payload, create your own notification client-side using the mock loc-key and loc-args values, and then show that to the user.

Certainly not the ideal solution however, we'll try to get in touch with the developers and see if it would be possible to add that functionality to the REST API.



来源:https://stackoverflow.com/questions/36407583/bluemix-push-notification-support-for-apple-localized-alert-messages

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!