Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

Commit

Permalink
Update PAYLOAD.md (#2602)
Browse files Browse the repository at this point in the history
Creates PR in response to #2449
  • Loading branch information
ramon-dejesus authored and macdonst committed Oct 29, 2018
1 parent 07b8d7f commit 2f45c0d
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions docs/PAYLOAD.md
Original file line number Diff line number Diff line change
Expand Up @@ -2108,6 +2108,33 @@ Here's a sample JSON payload to send a push notification to an Android or iOS de
}
```
On iOS, using the FCM app server protocol, if you are trying to send a silent push and foreground pushes are not being triggered, try adding the ("content_available" : true) field to your payload. Here's the above sample JSON payload with this field included:
```json
{
"to" : "bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1...",
/* To send a silent push, omit the entire notification section and send only data */
"notification": {
"title": "Test title", /* The notification's title */
"body": "Test body.", /* The notification's body text */
"subtitle": "Test subtitle", /* iOS: The notification's subtitle */
"sound": "default", /* The sound to play when the device receives the notification */
"tag": "1", /* Android: Group notifications with the same tag */
"icon": "push_icon", /* Android: PNG icon from the res/drawable folder */
"color": "#AABBCC" /* Android: Icon's background color in #RRGGBB format */
},
/* Optional payload that will be available from data.additionalData */
"data": {
"custom_var_1": "custom value here", /* Retrieved on app as data.additionalData.custom_var_1 */
"custom_var_2:" "custom value here" /* Retrieved on app as data.additionalData.custom_var_2 */
},
/* Forces FCM silent push notifications to be triggered in the foreground of your iOS device. */
"content_available": true
}
```
*Doc modification came in response to @andreszs - Issue [#2449](https://github.com/phonegap/phonegap-plugin-push/issues/2449).
** IMPORTANT: When using the content_available field, Android payload issues may occur. [Read here](../docs/PAYLOAD.md#user-content-use-of-content_available-true) Make sure you separate your Android/iOS server payloads to mitigate any problems that may arise.
More information on how to send push notifications using the FCM HTTP protocol and payload details can be found here:
- [Send messages using the legacy app server protocols](https://firebase.google.com/docs/cloud-messaging/send-message#send_messages_using_the_legacy_app_server_protocols 'Send messages using the legacy app server protocols')
Expand Down

0 comments on commit 2f45c0d

Please sign in to comment.