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

Commit 1c4b9c4

Browse files
authored
Merge pull request #954 from zhangjunhou/master
fix fcm isForeground
2 parents befe905 + 0ad7b12 commit 1c4b9c4

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotificationListenerService.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,11 @@ private void handleRemotePushNotification(ReactApplicationContext context, Bundl
129129
}
130130

131131
Log.v(LOG_TAG, "sendNotification: " + bundle);
132-
133-
Application applicationContext = (Application) context.getApplicationContext();
134-
RNPushNotificationHelper pushNotificationHelper = new RNPushNotificationHelper(applicationContext);
135-
pushNotificationHelper.sendToNotificationCentre(bundle);
132+
if (!isForeground) {
133+
Application applicationContext = (Application) context.getApplicationContext();
134+
RNPushNotificationHelper pushNotificationHelper = new RNPushNotificationHelper(applicationContext);
135+
pushNotificationHelper.sendToNotificationCentre(bundle);
136+
}
136137
}
137138

138139
private boolean isApplicationInForeground() {

0 commit comments

Comments
 (0)