问题
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