onNotification called only once in Android and not called again on notification open(userInteraction not updated)
See original GitHub issueI have a function that is called on onNotification
. This function checks for link that comes in data and checks for user interaction to be true
- if condition passes then navigation function is called to navigate to needed screen in the app.
All this looks something like:
PushNotification.configure({
....
onNotification: this._onNotification.bind(this),
....
});
_onNotification(notification) {
....
if (notification && notification.userInteraction) {
let data = notification.data || {};
if (data && data.link) {
//do navigation to link
}
}
}
This works all good with iOS where notification.userInteraction changes from false to true on notification click and app opening. The onNotification is called once more and passes condition, therefore does the navigation. With android as far as I got from debugging the app - onNotification is called only once and only on notification being received, when you click on notification to open app - onNotification is not updated and called once more.
My current RN version is 0.39 and current react-native-push-notification version is 2.2.1
Any ideas or suggestions that would help to resolve the issue? 😃
Issue Analytics
- State:
- Created 7 years ago
- Comments:9
Top GitHub Comments
Has there been any progress on this at all? I’m seeing the same. App open - onNotification called. App closed or in the background - Notification shown in notification center. Clicking on notification does not result in onNotification being called though.
Me also. onNotification is called ONLY WHEN the app is running on foreground