Push notifications handling in ios

#1

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

#2

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.

#3

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

#4

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

closed #5

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