Expo Push Notifications in background

I have a doubt regarding a point mentioned in expo docs:

Expo apps don’t support background code execution (running code when the app is not foregrounded or the device is sleeping). This means you cannot use background geolocation, play audio in the background, handle push notifications in the background, and more. This is a work in progress.

When the app is open and is in foreground or background and some other user sends him/her a chat message then the push notifications are working fine.

So what if the user has not opened the app yet then will he receive a push notification as soon as some other user sends this user a chat message?

Thanks in Advance!

Yes, the user will receive a push notification when the app is backgrounded. The docs are saying that you can’t do run any app specific code when the push notification is received and the app is backgrounded, but the user will still see it.

3 Likes

Hi there

I was just about to post about the same issue. Thanks @jesse for your contribution, I have a small follow-up question though:

In my current (Xamarin) app on Android, I actually get some JSON as a push message, which I then parse into a (localized) message displayed to the user. If the app isn’t running, it’s being started and I have the chance of handling the message. So you are saying this isn’t possible with expo?

Thanks!

1 Like

@hardcodet, correct that’s not possible on Expo without detaching right now. We eventually want to support something like that but it might be a while.

2 Likes

Hi @jesse …thanks for the clarification, I was very close to ditching Expo but I read your comment, now I’m sticking with it. It may be worth clarifying this in the “Why Not Expo” documentation

1 Like

thank you @jesse for this info. But please i wanna know if there is a different way of making the push notification work before opening the app or is it just the usual way.