react-native-push-notification: onNotification is not called when a remote notification is pressed on Android
Hi,
onNotification
is not get called when i press a notification.
The doc https://github.com/zo0r/react-native-push-notification#usage says that
onNotification
Called when a remote or local notification is opened or received.
This callback is called twice when a notification is received:
1.
{collapse_key: "XX" foreground: true google.delivered_priority: "high" google.message_id: "0:1587387492329033%3a743ff23a743ff2" google.original_priority: "high" google.sent_time: 1587387492305 google.ttl: 2419200 id: "-1393396919" issueId: "XX" notification: body: "XX" sound: "default" tag: "XX" title: "XX" userInteraction: false}
2.
{foreground: true id: "-1409941121" issueId: "XX" message: "XX" title: "XX" userId: "XX" userInteraction: false}
Can anybody help me with this problem?
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 94
@Dallas62 I opened a new issue since I think the one you mentioned describes a different problem. I hope this is ok.
@Dallas62 of course, I will make it ASAP, and give the report.
@Dallas62 i guess this is an error in docs. The code below should be in
android/app/build.gradle
, but not inandroid/build.gradle
I’m using manual linking, so this is important.
Yes,
onNotification
is called when the app is active in foreground and when the notification is opened/touched in background and quit state. And notifications appear as soon as the app is not in foreground state.Firebase worked for me as well for receiving the notifications but I was unable to detect, when they were opened which is why I switched to the above solution.
same problem onNotification does not call when I click the notification from the tray instead it reopens the app and onRegister get triggered
same problem here, the
onNotification
is called only on foreground or for local notifications. If i press the remote notification nothing happens, only open the app.@anisimov74 In the
example
folder 😉I’m also unable to get
onNotification
called when the app in a background mode or killed.PushNotification.popInitialNotification
always returns null@Dallas62 here it is