You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FirebaseMessaging.onMessageOpenedApp is never triggered, even when I click notification (app is killed), then app opens.
I can see in flutter logs
this is working fine FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
void main() async {
await _initializeFirebase(config.isProduction);
// below stuff not relevant as we initialise right away firebase
runZonedGuarded(() {
runApp(AppConfigWidget(
config: config,
child: BlocProvider<AppBloc>(
create: (context) => appBloc,
child: App(
locale: locale,
),
),
));
},
config.isProduction
? FirebaseCrashlytics.instance.recordError
: _reportCrash);
}
Future<void> _initializeFirebase(bool isProduction) async {
await Firebase.initializeApp();
await FirebaseCrashlytics.instance
.setCrashlyticsCollectionEnabled(isProduction);
if (isProduction) {
// Pass all uncaught errors from the framework to FirebaseCrashlytics.
Function originalOnError = FlutterError.onError;
FlutterError.onError = (FlutterErrorDetails errorDetails) async {
await FirebaseCrashlytics.instance.recordFlutterError(errorDetails);
// Forward to original handler.
originalOnError(errorDetails);
};
}
PushNotificationsManager();
FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
FirebaseMessaging.onMessageOpenedApp.listen((message) {
// THIS IS NEVER TRIGGERED!!!
getLogger('app_runner').d('Firebase.onMessageOpenedApp: ${message.data}');
// The call below does app internal logic, just parses notification data and redirects to other view (which worked fine before //upgrade to 10.0.2
PushNotificationsManager.handle(message);
});
}
/// Define a top-level named handler which background/terminated messages will
/// call.
/// To verify things are working, check out the native platform logs, flutter logs
Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
await Firebase.initializeApp();
getLogger('app_runner').d('Firebase.onBackgroundMessage: ${message.data}');
}
As mentioned _firebaseMessagingBackgroundHandler this works fine !!! when app is closed/killed in flutter logs command the logs appear, but when clicking the notification we expect onMessageOpenedApp.listen callback to run, and to read same notification there, then handle it in our extra class and redirect user to proper view
Also what is difference between getInitialMessage and onMessageOpenedApp
Flutter doctor
flutter doctor -v
[✓] Flutter (Channel stable, 2.2.2, on macOS 11.4 20F71 darwin-x64, locale en-DE)
• Flutter version 2.2.2 at /Users/kristi.jorgji/flutter
• Framework revision d79295af24 (2 weeks ago), 2021-06-11 08:56:01 -0700
• Engine revision 91c9fc8fe0
• Dart version 2.13.3
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at /Users/kristi.jorgji/Library/Android/sdk
• Platform android-30, build-tools 29.0.3
• ANDROID_HOME = /Users/kristi.jorgji/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.5, Build version 12E262
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
[✓] IntelliJ IDEA Ultimate Edition (version 2020.2.3)
• IntelliJ at /Users/kristi.jorgji/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
[✓] VS Code (version 1.57.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension can be installed from:
🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (3 available)
• SM J510FN (mobile) • badea702 • android-arm • Android 7.1.1 (API 25)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 7.0 (API 24) (emulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.114
• No issues found!
The text was updated successfully, but these errors were encountered:
Bug report
FirebaseMessaging.onMessageOpenedApp is never triggered, even when I click notification (app is killed), then app opens.
I can see in
flutter logs
this is working fine
FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
This is never getting executed
Versions
firebase_messaging: ^10.0.2
Usage
main.dart
As mentioned
_firebaseMessagingBackgroundHandler
this works fine !!! when app is closed/killed in flutter logs command the logs appear, but when clicking the notification we expect onMessageOpenedApp.listen callback to run, and to read same notification there, then handle it in our extra class and redirect user to proper viewAlso what is difference between
getInitialMessage
andonMessageOpenedApp
Flutter doctor
The text was updated successfully, but these errors were encountered: