Push notifications

Hey there. I’m evaluating Expo for a project at the moment and stumbled upon the “Why not Expo?” page. There it states that Expo does not support background code execution.
What does this mean exactly for push notifications?

it doesn’t necessarily mean anything for push notifications unless you need to be able to handle push notifications while your app is closed or backgrounded. do you have some specific requirements for push notifications that you’re concerned that you won’t be able to do?

Okay. Then it seems fine :slight_smile:
I’m new to mobile development and wasn’t sure if a app needs to be active in the background to display push notifications.
No special handling needed inside the app when receiving the notifications. Notifications should open the right sub page in the app. That’s possible, right?

you have to explicitly handle when a notification is opened and make your app do what you expect it to do in that case – there isn’t any automatic ‘jump to this screen within my app’ kind of behavior, opening a push notif just foregrounds/opens your app and you need to implement a handler with Notifications.addListener

I would really appreciate some clarity on this too—I’m making an auction app, and I have two main scenarios where I need push notifications:

  1. New sale has started
  2. Someone has outbid you.

In both of those scenarios, it’s very possible the app isn’t open or it’s backgrounded. The way the expo documentation reads, it sounds like you can’t receive push notifications when the app isn’t open—but that defeats the purpose of push notifications, doesn’t it?

I can see the use case of in app notifications, but many apps use push notifications to get the users back inside the app after not opening it for a while.

Am I misunderstanding?

users receive push notifications when the app isn’t open, but the app can’t execute any logic in response to the push notification until the user opens the notification

@notbrent I really appreciate the quick response, thank you! That makes a lot more sense—could you please give an example of what kind of logic could a non-expo app would execute? I’m just curious about a common use case.

Something like this? https://medium.com/posts-from-emmerge/ios-push-notification-background-fetch-demystified-7090358bb66e

1 Like

yup. oops i missed this message :sweat_smile: