Push Notifications Android Oreo while app is background/closed not working?


#1

Hey guys,

I am on expo SDK 28 and have my app setup to use the Expo Push Notifications API. My app asks for permission on iOS, and does the permission request on Android which passes due to the install permission (I assume that it includes that by default because push notifications work on Android < 8.0). I save the token and send it to my server and push notifications are working for iOS, and Android version before Oreo. I have a channel set up on Oreo and I am sending notifications to that channel. When the app is open I receive the notifications like this:

{
  "data": null,
  "isMultiple": false,
  "notificationId": 1440457566,
  "origin": "received",
  "remote": true,
}

So I am in-fact receiving push notifications on Android Oreo when my app is open. However, if the app is backgrounded or closed I receive nothing. I am seeing these push notifications in the app from the Notifications.addListener function.

I am not exactly sure what is going on here to cause me to not receive notifications in background / app closed state, any ideas?

P.S. Also, why do I not get any of the other fields (title, body) on the in-app notification on Android Oreo?


#2

Hi @rcastner. There is a bug related to background push notifications in Android Oreo right now, it’ll be fixed for FCM when SDK 29 is released.

P.S. Also, why do I not get any of the other fields (title, body) on the in-app notification on Android Oreo?

Are you getting these field on Android < 8.0?


#3

@jesse thanks for the quick response! Oh man, I was trying this for hours but I wanted to give it my best before I bugged you guys.

Are you getting these field on Android < 8.0?

Yeah I was getting background notifications just fine on Android < 8.0 without passing anything to the optional data key, on Oreo 8.0 I actually added the title, body fields to data so I could get the message.


closed #4

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.