I'm implementing push notifications in an app, but I need to handle the notification to navigate to a specific screen. The problem is that my listener never fires, I searched a lot on google and tried a lot of things but none of them worked..
I'm using AWS SNS together with FCM to send the push.
What I have is this in my App.tsx:
componentDidMount() {
Notifications.addListener(notification => {
alert("IT WORKED")
})
}
But ofcourse this alert is never called..
I read this issue https://github.com/expo/expo/issues/4183 and it seems that the format of the push matters, so right now I'm sending the push in this format:
{
"GCM": "{ \"notification\": { \"message\": \"Sample message for Android endpoints\", \"title\": \"Hello You...\" } }"
}
And I receive the push, but when I click on it to open the app, doesn't fire my listener, but in the issue the guy said to send like this:
{
"GCM": "{ \"data\": { \"message\": \"Sample message for Android endpoints\", \"title\": \"Hello world...\", \"body\": \"msg body\", \"experienceId\": \"@expousername/app-slug\" } }"
}
But if I send like this, I don't even receive the push.
What I'm doing wrong?