Flutterfire: [firebase_messaging] onLaunch event always run when use Navigator.of(context)

Created on 13 Oct 2019  Â·  5Comments  Â·  Source: FirebaseExtended/flutterfire

Steps to Reproduce

onLaunch event always run when use Navigator.of(context).pushReplacementNamed

for example: when i sent notification and the app in background, and go to another screen and go back by using pushReplacementNamed, onLaunch will run again

customer messaging bug

Most helpful comment

Hello,
This issue is always here, even with the last version of Flutter and the plugin.

flutter doctor -v
[√] Flutter (Channel stable, v1.9.1+hotfix.6, on Microsoft Windows [version 10.0.18362.449], locale fr-FR)
• Flutter version 1.9.1+hotfix.6 at C:\ProgramData\flutter
• Framework revision 68587a0916 (7 weeks ago), 2019-09-13 19:46:58 -0700
• Engine revision b863200c37
• Dart version 2.5.0

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Android\android-sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• ANDROID_HOME = C:\Android\android-sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
• All Android licenses accepted.

[√] Android Studio (version 3.5)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 40.2.2
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)

[√] VS Code (version 1.34.0)
• VS Code at \AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.5.1

[√] VS Code, 64-bit edition
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 3.5.1

[√] Connected device (1 available)
• JSN L21 • MUENW18B23003850 • android-arm64 • Android 9 (API 28)

• No issues found!

All 5 comments

@aboda1986

The issue at https://github.com/flutter/flutter/issues/28581 has been closed and moved here. Future collaboration on this issue will be done here.

Hi @aboda1986
are you still experiencing this issue with the latest version of Flutter and firebase_messaging?
If so can you please provide your flutter doctor -v?
Also, to better address the issue, would be helpful
if you could post a self contained app on github
or the steps to reproduce it.
Thank you

1060

Hello,
This issue is always here, even with the last version of Flutter and the plugin.

flutter doctor -v
[√] Flutter (Channel stable, v1.9.1+hotfix.6, on Microsoft Windows [version 10.0.18362.449], locale fr-FR)
• Flutter version 1.9.1+hotfix.6 at C:\ProgramData\flutter
• Framework revision 68587a0916 (7 weeks ago), 2019-09-13 19:46:58 -0700
• Engine revision b863200c37
• Dart version 2.5.0

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Android\android-sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• ANDROID_HOME = C:\Android\android-sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
• All Android licenses accepted.

[√] Android Studio (version 3.5)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 40.2.2
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)

[√] VS Code (version 1.34.0)
• VS Code at \AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.5.1

[√] VS Code, 64-bit edition
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 3.5.1

[√] Connected device (1 available)
• JSN L21 • MUENW18B23003850 • android-arm64 • Android 9 (API 28)

• No issues found!

A little example :

firebaseMessaging.configure(
onResume: (Map<String, dynamic> message) =>
Navigator.pushNamed(context, 'test'),
onLaunch: (Map<String, dynamic> message) =>
Navigator.pushNamed(context, 'test'));

Hey all 👋

As part of our roadmap (#2582) we've just shipped a complete rework of the firebase_messaging plugin that aims to solve this and many other issues.

If you can, please try out the dev release (see the migration guide for upgrading and for changes) and if you have any feedback then join in the discussion here.

Given the scope of the rework I'm going to go ahead and close this issue in favor of trying out the latest plugin.

Thanks everyone 🤓

Was this page helpful?
0 / 5 - 0 ratings