-
-
Notifications
You must be signed in to change notification settings - Fork 2k
onNotification called only once in Android and not called again on notification open(userInteraction not updated) #333
Comments
I'm also seeing the app being opened when you click the notification, but onNotification not being called. |
Me also. onNotification is called ONLY WHEN the app is running on foreground |
I get this too, any solution? |
Maybe it is not nice to promote other package, but I didn't find easy fix so switched to https://github.com/wix/react-native-notifications/ It is easier to implement(less stuff to do in manifest) and it has separated methods: Main concern for me was that iOS and Android functionality is not unified, but I've simply created |
I am experiencing this as well. It appears that |
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. |
Hope this helps others. Here is how I got the my Android code to read in data from notification when launching app from background/killed state. there are two different notification logics for foreground and background/killed apps.
onMessageReceived() is executed only for foreground apps. You can get “notification” and “data” by using remoteMessage.getNotification() and remoteMessage.getData().
Make sure your notification has 2 components in them Inside your MainActivity.java, do something along the lines of the following:
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions. |
I have a function that is called on
onNotification
. This function checks for link that comes in data and checks for user interaction to betrue
- if condition passes then navigation function is called to navigate to needed screen in the app.All this looks something like:
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? :)
The text was updated successfully, but these errors were encountered: