React-native-push-notification: onNotification not triggered for Android local notifications

Created on 18 Oct 2016  路  17Comments  路  Source: zo0r/react-native-push-notification

I can confirm that the onRegister callback gets called every time the library gets configured. I have a valid token. Whenever I send a local notification on Android, the notifications appears at the top. However, clicking on that notification does not result in the onNotification callback being triggered--neither when the app is foregrounded nor when it is backgrounded. This callback gets correctly triggered on iOS, so the issue is only on Android. Is there a fix for this or am I missing something?

I cannot yet test whether onNotification is triggered in Android for remote notifications, but that is ultimately where I'll need it to work. If the callback isn't being triggered for local notifications, I'm worried that it won't be triggered for remote notifications.

RN version: 0.34.
RNPN version: 2.1.1.
Occurs on Emulator.

Stale

Most helpful comment

@jfrey
I have the same problem. If I click on a notification then the onNotification gets triggered. But if I don't click on it then it never get's triggered. I don't use push notifications, only local and scheduled notifications.

What I want to do is when the notification is triggered/shown I need to remove the ID from my Redux store. That's why I want to get this callback to work :-/

It has almost been a year, and lot of people are experiencing the same issue. Any progress? #170

All 17 comments

It's working for my, can you try using master? change your package.json to:

"react-native-push-notification": "[email protected]:zo0r/react-native-push-notification.git",

Still having this issue, even off of master. I'm using the Emulator, if that makes a difference.

@npomfret I noticed that you had a similar issue in #93.

Might the issue be in my AndroidManifest.xml? The applicationId being inconsistent? I think some notification event listener is not getting fired or something. Whether on the Android side or the JS side, I'm not sure. But perhaps the Android side.

Hi, I have same problem, but with real 4.4.2 android device. RN v0.35.0.
In my case onNotification called when when I pressed on localNotifacation and app is active or in background, but nothing happens when app is closed.

I'm having the same issue on RN v0.35.0. As @bo4a10 says, it fires when the app is active, but not when closed.

@bo4a10 @danleveille I found that I actually have an opposite issue. Local notifications on Android fire when the app is started from the tray (and is closed), but when the app is in the background or in the foreground, onNotification is not called.

@npomfret But I have verson 2.1.1, not 2.2.0.

My version is 2.1.1 and I'm having the same issue but its on remote notification.
onNotification is getting called when the app is in foreground but it is not getting call when a remote notification is clicked whether the app is in background or closed.
@simonayzman did you manage to get a solution for this one?

I've run into this as well with local notifications. If I receive one and I click on the notification then the app is notified via the callback. If I receive one and do not click on the notification then the app is not notified (even if the app is in the foreground).

I'm on 2.2.1 with 0.40.0.

+1 i have the same as @jfrey trouble (2.2.1 with 0.41.2)

+1 I also have the same issue as @jfrey

Has this been resolved?

@jfrey
I have the same problem. If I click on a notification then the onNotification gets triggered. But if I don't click on it then it never get's triggered. I don't use push notifications, only local and scheduled notifications.

What I want to do is when the notification is triggered/shown I need to remove the ID from my Redux store. That's why I want to get this callback to work :-/

It has almost been a year, and lot of people are experiencing the same issue. Any progress? #170

Any solution here?

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.

Was this page helpful?
0 / 5 - 0 ratings