1
final FirebaseMessaging firebaseMessaging = FirebaseMessaging();
firebaseMessaging.requestNotificationPermissions();
firebaseMessaging.configure(onLaunch: (Map<String, dynamic> msg) {
  print(" onLaunch called");
  return;
}, onResume: (Map<String, dynamic> msg) {
  print(" onResume called");
  return;
}, onMessage: (Map<String, dynamic> msg) {
  print(" onMessage called");
  return;
});

which is my code in inistate function of my main screen.

When the app is not on the foreground ,if I send notification through the cloud messaging, I am getting notification successfully. However when my app is on the launch, I am not not getting nay console log from my code.

what I am expecting that code, when my app is on launch , I had to get " onLaunch called" Console log message.

But I am not getting anything. I think that the configure function is not working properly.

Is there anyone who knows why this kind of problem happens?

enter image description here Thanks for reading.

Cem Kaan
  • 2,086
  • 1
  • 24
  • 55
DaegilPyo
  • 420
  • 1
  • 7
  • 17
  • Hi, interesting, perhaps check the logs to see if the request was sent? – IronMan Nov 07 '20 at 01:40
  • Nothing showing up on debug console... I am using with VScode. – DaegilPyo Nov 07 '20 at 01:51
  • you try to put a data key in your payload? Like this: data: { title: "title here", alert: "message here" } – Claudio Castro Nov 07 '20 at 02:06
  • for now I am sending notification manually through the cloud messaging in firebase website. But I am not getting any payload through that,,, so frustrating , I can not go next step without solving this problem – DaegilPyo Nov 07 '20 at 02:14
  • look this https://stackoverflow.com/questions/56025164/firebase-messaging-onresume-and-onlaunch-not-working – Claudio Castro Nov 07 '20 at 02:26
  • refer this https://stackoverflow.com/a/62596533/12037365 – Mr vd Nov 07 '20 at 04:23
  • Can you please show us your notification data? – Jigar Fumakiya Nov 07 '20 at 05:18
  • Thanks for the comment on my question ! I solved my problem , but I don't know why it was not working before.... But now everything is working properly !!! I can go next step to make my app !! Thank you everyone. – DaegilPyo Nov 07 '20 at 05:40

0 Answers0