Firebase iOS 10 Notification Not Displaying in Background

I’m having problems receiving push notifications (background) on a specific iOS 10 device. Other iOS 9 phones work fine.

Although, if I open the application, the notification shows a banner that I implemented. Why is nothing displayed in the background?

Reading the firebase documentation something made me a little confusing

According to the firebase github example, at the following link https://github.com/firebase/quickstart-ios/blob/master/messaging/FCMSwift/AppDelegate.swift , there was a comment in the didReceiveRemoteNotification method that states:

// If you receive a notification while your application is in the background, // this callback will not be launched until the user touches the notification that launches the application. // TODO: process notification data

So, my application is in the background, isn't the apple doing all this to make this the default iOS notification? Does the value of content_available affect this? I also send notification and data values.

Here is an example of the JSON I'm sending:

{
    "content_available": true,
    "priority": "high",
    "data": {
        "post_id": "...",
        "push_id": "..."
    },
    "notification": {
        "title": "...",
        "body": "..."
    },
    "registration_ids": ["xxxx"]
}

Expected Behavior:

  • App dead: system will show notification
  • Application background: the system will display a notification and will call the didReceiveRemoteNotification method.
  • Application is active: the system will NOT show a notification and will call the didReceiveRemoteNotification method.

Right?

+4
1

, 2. , didReceiveRemoteNotification, content_avialable.

1)

2) " "

3) , . Apple .

, , didReceiveRemoteNotification.

+2

Source: https://habr.com/ru/post/1656007/


All Articles