I have my iOS app set up to receive push notifications via GCM. Having set everything up, I am able to receive notifications when the app is in the foreground on various Apple devices. However, when the app is in the background, I only receive push notifications for certain devices, namely only my iPhone 6. Other devices, such as an iPhone 5s and an iPod Touch are only able to capture notifications when the app is in the foreground.
I looked into other people's questions regarding this issue, bug I have yet to see one that is device model specific. Often it comes down to not setting the content_available: true
setting, but I have it set. Here is an example of a payload I am using:
{
"to":".....",
"content_available":true,
"notification": {
"title":"my title",
"body":"my body",
"sound":"default"
}
}
I receive this background notification exactly how I'd want to on my iPhone 6 (my phone is woken and I see a banner), but other devices (which are also using iOS v8.4.1) do not respond to the notification when the app is in the background.
Other details:
Any thoughts would be appreciated.
In the Messages app on your Mac, choose Messages > Preferences, then click iMessage. In the Settings pane, select Enable Messages in iCloud. The messages from your other devices that use the same Apple ID appear on your Mac. Note: Depending on how many messages you have, it may take a while for all of them to appear.
iOS enables you to both disable push notifications entirely, or turn them off for individual apps. To access iOS notifications settings, go into the Settings > Notifications menu. From that list, you can configure each app's notifications settings or disable them.
You should add the priority
parameter to your request. For example
{
"to":".....",
"content_available":true,
"priority": "high", // Add this field corresponds to 10 for APNS
"notification": {
"title":"my title",
"body":"my body",
"sound":"default"
}
}
Here is the GCM reference that mentions the priority
field. In case you do not set the priority level the message is sent via Normal
priority which in APNS's case is highly variable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With