File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
OneSignalSDK/onesignal/src/main/java/com/onesignal Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ private static int processJobForDisplay(OSNotificationController notificationCon
146
146
147
147
if (doDisplay ) {
148
148
androidNotificationId = notificationJob .getAndroidId ();
149
- if (fromBackgroundLogic && OneSignal .shouldFireForegroundHandlers ()) {
149
+ if (fromBackgroundLogic && OneSignal .shouldFireForegroundHandlers (notificationJob )) {
150
150
notificationController .setFromBackgroundLogic (false );
151
151
OneSignal .fireForegroundHandlers (notificationController );
152
152
// Notification will be processed by foreground user complete or timer complete
Original file line number Diff line number Diff line change @@ -2299,7 +2299,7 @@ static void handleNotificationReceived(OSNotificationGenerationJob notificationJ
2299
2299
* <br/><br/>
2300
2300
* @see OSNotificationWillShowInForegroundHandler
2301
2301
*/
2302
- static boolean shouldFireForegroundHandlers () {
2302
+ static boolean shouldFireForegroundHandlers (OSNotificationGenerationJob notificationJob ) {
2303
2303
if (!isInForeground ()) {
2304
2304
OneSignal .onesignalLog (LOG_LEVEL .INFO , "App is in background, show notification" );
2305
2305
return false ;
@@ -2310,6 +2310,12 @@ static boolean shouldFireForegroundHandlers() {
2310
2310
return false ;
2311
2311
}
2312
2312
2313
+ // Notification is restored. Don't fire for restored notifications.
2314
+ if (notificationJob .isRestoring ()) {
2315
+ OneSignal .onesignalLog (LOG_LEVEL .INFO , "Not firing notificationWillShowInForegroundHandler for restored notifications" );
2316
+ return false ;
2317
+ }
2318
+
2313
2319
return true ;
2314
2320
}
2315
2321
You can’t perform that action at this time.
0 commit comments