Is it possible to not display a local notification over the app when the app is running (Android)?
This repo doesn't appear to be getting updates anymore.
This is an issue with the FCM listener service, it works correctly when using GCM.
To fix you need to edit RNPushNotificationListenerService.java
and change the following lines in the handleRemotePushNotification function (line 133)
from:
Application applicationContext = (Application) context.getApplicationContext();
RNPushNotificationHelper pushNotificationHelper = new RNPushNotificationHelper(applicationContext);
pushNotificationHelper.sendToNotificationCentre(bundle);
to:
if (!isForeground) {
Application applicationContext = (Application) context.getApplicationContext();
RNPushNotificationHelper pushNotificationHelper = new RNPushNotificationHelper(applicationContext);
pushNotificationHelper.sendToNotificationCentre(bundle);
}
Thank you, @tankers746, I will give it a try. Is there a living fork of this repo? Maybe we should create one?
I've got a fork with this fix, will try and sort out the android custom sound issue as well:
https://github.com/fleeteng/react-native-push-notification
@tankers746 thank you!
Can you explain how I would determine if I am using FCM or GCM
I appear to be experiencing this or a similar issue.
My experience is that local notifications appear as a system (remote) notification in that the OS pops the notification over the app as if it were in the background.
The converse is also true, when the app is running in the background a remote notification is actually NOT displayed and in debug I can see the app receives it.
Its like a swap between foreground and background processing
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.
Most helpful comment
This repo doesn't appear to be getting updates anymore.
This is an issue with the FCM listener service, it works correctly when using GCM.
To fix you need to edit RNPushNotificationListenerService.java
and change the following lines in the handleRemotePushNotification function (line 133)
from:
to: