Please provide the following:
- SDK Version: 39
- Platforms: iOS/Android
I have an ejected app where we use push notifications.
Notifications are working as expected for both Expo client and TestFlight build, but the production app doesn’t handle notifications correctly, seems like the handler function is not executed.
This is the code we have:
class RootStack extends Component {
async componentDidMount () {
// Listener for notifications opened while the app is on background.
this.notificationOpenedListener =
Notifications.addNotificationResponseReceivedListener(this.onNotificationOpened)
// Listener for notifications received while the app is running - foregrounded.
this.notificationReceivedOnForegroundListener = Notifications.setNotificationHandler({
handleNotification: this.onNotificationReceivedOnForeground,
handleError: error => {
const cleanError = cleanseErrorForLogging(error)
Logger.error('Error while handling notification - app was in foreground', cleanError)
}
})
this.createAndroidPushChannel()
}
onNotificationOpened = ({ notification }) => {
// Do some stuff with the notification
}
onNotificationReceivedOnForeground = async (notification) => {
// Do some stuff with the notification
}
}
I can’t figure out what is missing here, does anyone had this issue before?