Skip to content

notification_open event not triggered properly when flutter app in background mode #17072

@TharushiSewmini

Description

@TharushiSewmini

Description

The issue is as follows:

When transitioning the app from the live foreground mode to the background, there are two ways to do so:

Pressing the home button for quick navigation.
Pressing the back button multiple times to exit.
If the app is moved to the background using the home button, when a push notification arrives and I tap on it, the onMessageOpenedApp event is triggered, but the notification_open event is not triggered.
However, if the app is moved to the background by pressing the back button multiple times, when a new notification arrives and I tap on it, the notification_open event is triggered.
This means that the count for notification_open will be updated only in the second case. I tested it only using android. I don't know how about IOS

That is the issue I faced when I did my project.
versions are
Flutter 3.27.3
firebase_core: ^3.10.1
firebase_analytics: ^11.2.0
firebase_messaging: ^15.0.3

Reproducing the issue

No response

Firebase SDK Version

3.6.0

Xcode Version

Installation Method

Swift Package Manager

Firebase Product(s)

Analytics, Messaging

Targeted Platforms

N/A

Relevant Log Output

If using Swift Package Manager, the project's Package.resolved

Expand Package.resolved snippet
Replace this line with the contents of your Package.resolved.

If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet
Replace this line with the contents of your Podfile.lock!

Activity

google-oss-bot

google-oss-bot commented on Feb 11, 2025

@google-oss-bot

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

SelaseKay

SelaseKay commented on Feb 11, 2025

@SelaseKay
Contributor

Hi @TharushiSewmini, thanks for the report. I was able to reproduce the issue and suspect it might be originating from the underlying Android SDK. We'll investigate further.

SelaseKay

SelaseKay commented on Feb 11, 2025

@SelaseKay
Contributor

Hi @TharushiSewmini, I observed the same behavior when testing with the Android SDK. For further clarification on this issue, you can report it here.

flappygod

flappygod commented on Mar 5, 2025

@flappygod

The onReceive method of FlutterFirebaseMessagingReceiver is triggered only once after the app is installed, even though the notification is successfully displayed in the notification bar. This behavior is unexpected and requires further investigation to determine the cause.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @google-oss-bot@flappygod@SelaseKay@TharushiSewmini

        Issue actions

          notification_open event not triggered properly when flutter app in background mode · Issue #17072 · firebase/flutterfire