When you publish a message with mobile push payload attributes (pn_apns and pn_gcm), the specified mobile push messages will always be sent to all devices registered for mobile push notifications on the channel that the message was published to.
{ "pn_apns": { "aps": { "alert": "Your order is ready for pickup!", "payment_info": { "credit_card": 987656789876, "expiration": "0108" } } }, "pn_gcm": { "notification": "Your order is ready for pickup!", "payment_info": { "credit_card": 987656789876, "expiration": "0108" } }, "message": { "info": "This is data all non-APNS and non-GCM devices would receive. They would also receive the pn_apns and pn_gcm data." "note": "Your order is ready for pickup!", "payment_info": { "credit_card": 987656789876, "expiration": "0108" } } }
The entire payload above will be sent to active PubNub subscribers (including the pn_apns
and pn_gcm data). But only the data inside the pn_apns
section will be sent as an APNS message to registered iOS devices and data inside the pn_gcm section as an FCM message to registered Android devices, and displayed a push notification.