Push notifications handling in ios

Hi.

I have noticed that, if ios app is open and foregrounded origin == received
and if open and BACKGROUNDED origin is still == received

The thing is,
if the app is backgrounded and the user clicks the notification I want to redirect to the specific route,
but if the app is foregrounded and the user is just fooling around, I want to display some sort of notification at the top of the screen.

How to differentiate one from another?

Thanks

You might be able to look at AppState changes to see if the app is foregrounded or backgrounded in this case. It does seem nicer if Expo could do this for you, though.

Thing is, won’t the appstate always be foregrounded as it will always tick when, well, you foregrounded it?

Possibly, yes, but IIRC that’s how to distinguish if an app was foregrounded via a notification with the Objective-C APIs.

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