HomeiOS DevelopmentDealing with information notification solely in each iOS and Android fails

Dealing with information notification solely in each iOS and Android fails


I’ve a server that sends push notifications. For Android, I override onMessageReceived to deal with the message. For iOS, I exploit NotificationExtension. I want to vary the incoming push notification. What’s odd is that I can’t discover a option to make it work for each platforms. Here is the factor:

  • For Android, the payload of the push notification should NOT comprise a notification block. If there’s a notification block current, the title and physique of the notification shall be proven when the app is within the background and the onMessageReceived isn’t referred to as. This isn’t desired. Eradicating the notification block and simply hold information works for Android for each background and foreground mode.
  • After I omit the notification block for iOS, I get an error again from Firebase: InvalidParameters: Invalid notification payload.

Examples

Payload with out notification (works totally for Android on background + foreground mode, fails to ship (and thus retrieve) for iOS):

{
 "to" : "-",
 "information" : {
     "physique" : "Notification Physique",
     "title": "Notification Title",
 },
    "mutable_content": true
}

Payload with notification, this works totally for iOS however doesn’t name the onMessageReceived methodology on Android when the app is within the background:

{
 "to" : "-",
 "information" : {
     "physique" : "Notification Physique",
     "title": "Notification Title",
 },
    "mutable_content": true,
    "notification": { "title": "take a look at" }
}

How can I make each platforms work on foreground + background information push messages?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments