Expo Push Notification Detection

Viewed 594
1 Answers

Your app is not notified when it is closed/backgrounded, until the user interacts with it.

From the Expo 38 release notes:

If the notification is triggered while the app is in background,

  • it’s presented immediately

  • the application is not informed of this

If the notification is triggered while the app is in foreground,

  • the application not only receives immediate information about this, but…

  • it can also decide at runtime whether to display a heads-up alert or play a sound! (For more information see the Notification Handler documentation.)

From the Notifications overview, there are 2 listeners:

addNotificationReceivedListener - This listener is fired whenever a notification is received while the app is foregrounded

addNotificationResponseReceivedListener - This listener is fired whenever a user taps on or interacts with a notification (works when app is foregrounded, backgrounded, or killed)

The Notifications SDK is a good reference as well.

Related