Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ private static int processJobForDisplay(OSNotificationController notificationCon

if (doDisplay) {
androidNotificationId = notificationJob.getAndroidId();
if (fromBackgroundLogic && OneSignal.shouldFireForegroundHandlers()) {
if (fromBackgroundLogic && OneSignal.shouldFireForegroundHandlers(notificationJob)) {
notificationController.setFromBackgroundLogic(false);
OneSignal.fireForegroundHandlers(notificationController);
// Notification will be processed by foreground user complete or timer complete
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2299,7 +2299,7 @@ static void handleNotificationReceived(OSNotificationGenerationJob notificationJ
* <br/><br/>
* @see OSNotificationWillShowInForegroundHandler
*/
static boolean shouldFireForegroundHandlers() {
static boolean shouldFireForegroundHandlers(OSNotificationGenerationJob notificationJob) {
if (!isInForeground()) {
OneSignal.onesignalLog(LOG_LEVEL.INFO, "App is in background, show notification");
return false;
Expand All @@ -2310,6 +2310,12 @@ static boolean shouldFireForegroundHandlers() {
return false;
}

// Notification is restored. Don't fire for restored notifications.
if (notificationJob.isRestoring()) {
OneSignal.onesignalLog(LOG_LEVEL.INFO, "Not firing notificationWillShowInForegroundHandler for restored notifications");
return false;
}

return true;
}

Expand Down