Background GCM Push Notification Not Received on Certain Apple Devices

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:

  • In iOS, how can I store a secret “key” that will allow me to communicate with my server?
  • SQLite3 error - iOS
  • Passing data between classes using Objective-C
  • Attaching another view to the same “files owner”
  • AudioHardware.cpp:1200:AudioObjectRemovePropertyListener: AudioObjectRemovePropertyListener: no object with given ID 0
  • Run Xcode 6.x on macOS Sierra 10.12
  • {
        "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:

    • I am using Enterprise build
    • I am using the production APN server (and specify so in the GCM registration options)
    • Although I don’t think it’s necessary, I have all the devices registered with my Apple developer account.

    Any thoughts would be appreciated.

    Solutions Collect From Internet About “Background GCM Push Notification Not Received on Certain Apple Devices”

    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.