I’m using Expo’s push notification setup and we’re looking to track an event to Segment (and then onto Mixpanel) when a user taps and opens a notification. From reading the docs I can’t see any way of hooking into a callback to fire off an event to Segment.
Does Expo’s Push Notification setup have any way of firing some code when a notification is opened by the user?
You could use Notifications.addListener to set up a callback that would get executed whenever app receives a notification or a user taps on a notification. To verify whether the notification has been tapped or just received, use the origin property, which will be equal to selected if the user tapped the notification. You should be able to send a Segment event in the callback.
Oh goodness I didn’t see that in the docs, now I feel dumb. Thanks so much for your response here @sjchmiela! I’m gonna look into this this week and try and get something setup. Good to know on memory leaks too, will read!