Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

fixed duplicate sending of notifications in the foreground #1760

Closed
wants to merge 1 commit into from

Conversation

Dimon70007
Copy link
Contributor

No description provided.

@@ -172,7 +172,7 @@ private void handleRemotePushNotification(ReactApplicationContext context, Bundl
jsDelivery.notifyRemoteFetch(bundle);
}

if (config.getNotificationForeground() || !isForeground) {
if (config.getNotificationForeground() && !isForeground) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition doesn't make sense:
If "Allow notifications in foreground" and "Not in foreground":
Then Trigger the notification.

you probably missed a configuration on the AndroidManifest or in your app configuration...

Copy link
Contributor Author

@Dimon70007 Dimon70007 Nov 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With those changes showing local notifications works as expected (without duplication)
I use this repo in combine with react-native-firebase v6 messaging (for showing local notifications only)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not saying this change is not working for you, I'm saying that this change doesn't have sense (see the comment above).
If you experience duplicate notifications, this means there is a configuration issue in your project.

Copy link
Contributor Author

@Dimon70007 Dimon70007 Nov 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE: localNotification() works without changes in the application part

this is from readme, i use local notifications only with this library.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

anyway, thank you for great library

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  <!-- Change the value to true to enable pop-up for in foreground (remote-only, for local use ignoreInForeground) -->
        <meta-data  android:name="com.dieam.reactnativepushnotification.notification_foreground"
                    android:value="false"/>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, i've created a new PR about readme updating - #1762

@Dallas62 Dallas62 closed this Nov 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants