-
-
Notifications
You must be signed in to change notification settings - Fork 2k
onNotification does not fire when received on Android #170
Comments
What version of the package and RN are you using? Are you trying local or remote notification? |
RN 30, local notifications. |
I have the same issue with local notifications, when I schedule one and it fires |
I got same issue with local notifications and RN 0.33.0. |
So the previous behaviour was for onNotification() to be called immediately after sending a local (or scheduled) notification? Does this only affect Android? Has it started happening since RN 0.33? |
It never worked for me. I added this library around 0.31.0 only doing Android for now though. Looked through the Java code but could not find any callback to JS in the code that runs when the notification is fired. |
i.e. I'm not sure it ever worked as @npomfret describes |
Sorry, I was just asking a question. In order to fix it I need to know what is the desired / expected behaviour for receipt of a local notification? What does the iOS implementation do? |
Hi @npomfret , I am not sure what's the real behavior. Just because I click the notification, In ios when app is foreground, the notification never appear but just trigger onNotification. I upgrade to RN 0.33 from RN 0.30. Both of them have this issue. |
Ok, I think the answer to the question "what should the behaviour be?" is the same as iOS, right? I think the iOS behaviour is this:
Does that sound correct? |
@npomfret Yes, you are correct that is the way is works on IOS, and I really wish it would be the same on android (: |
Any progress on this? Not getting onNotification called while app in foreground on android |
Same issue. "onNotification" is not called on Android when notification arrives (only shows in notification center). After clicking the notification "onNotification" is triggered (but in that case, alert I want to display isn't showing because application can be in inactive state probably, when I added delay it start working). |
Hello guys! @npomfret |
We do some tests. We make a fork and implement notification to show in notification center only if application is in background. If application is in foreground we dispatch event to JS that arrives in "onNotification" from PushNotification.configure object (works the way it works on iOS). On both events we show alert. Now we can say, that alert triggered from notification in both cases not shows every time. We don't know why yet and I can't guarantee we gonna investigate it. You can test this fork https://github.com/MateuszMxxxx/react-native-push-notification but the code might not work correctly in every case (lack of native skill :/ ). We gonna make PR for this fork in the future. |
Hi! I have been struggling with this strange problem for a couple of hours before finding this issue. I'm not sure what the current status on this is? And I'm not sure it's the same problem I have. I will describe my problem, and maybe you could guide me on how to solve it? The function called As I understand it, this callback should be triggered whenever a notification is triggered, right? And the only thing that should change is What I need to do is when a notification is showed I need to dispatch an action to remove stuff from my Redux store. So this is the callback I should be using, right? Here is a video showing my problem: https://youtu.be/NwcBsameqQ0 |
Any progress on this? Is the onNotification not called on purpose? |
Any progress? |
btw, there's a PR waiting for aproval. For me now fires onNotification (tested only in foreground). |
My app is sitting in Beta (Google Play Console) for over 2 months now. Everything is working fine in iOS. I get remote PN and it wakes up the app, redirects the router to the correct page because Unfortunately I really hope this issue gets resolved soon. BTW @ital0 the PR you are referring to does not resolve the problem when the app is closed and in the background. I have really tried every solution available in the issue section without success.
|
@butterfly-thomasdittmar PR works for me, even when app is closed. Strange that doesn't works for you. |
@ital0, I updated that PR because I noticed that the userInteraction flag was overridden to false. Also @butterfly-thomasdittmar, @iggyfisk's solution from 122 worked for me. Once I added android.intent.category.INFO, it went to the right place. I can receive (local)notifications in the foreground and background on iOS and in the foreground and background (cold and warm start) on Android with Android firing the onNotification event. I'm not sure how much of this is bubble gum and bailing wire. Also, the app I'm coding for is using react-native-navigation that has both a splash screen and switches between single and tab-based app, so that added a bunch of other headaches. I haven't verified remote notifications as the app doesn't use them yet. It's still pretty finicky. |
So, there is a PR fixing this issue? But it doesn't get merged? How so? |
In my case, it is not working even when clicked on the notification. onNotification is bever called. |
Any solution? Still not working... |
Uh oh!
There was an error while loading. Please reload this page.
Is this feature not supported on android, or am I doing something wrong?
The text was updated successfully, but these errors were encountered: