Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

while clicking on notificaton in background state ,calling terminated state #2320

Open
premchanduv opened this issue May 6, 2024 · 0 comments

Comments

@premchanduv
Copy link

Describe the bug
while clicking on notification when app is background state app is opening via messageonopenedappstream but immediately it is calling getinitalmessagemethod

To Reproduce

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
while clicking on notification via background state it should open desired page only once dont call getinitalmessage

Sample code to reproduce the problem
FirebaseMessaging.instance.getInitialMessage().then((event1) {
if (event1?.notification != null) {
if(event1?.notification!.title=='New Order'){

  Future.delayed(const Duration(seconds: 1), () async {
 
  
  
    Get.toNamed(Kneworderscreen, arguments: event1?.data);
});

}
else{
  //Get.toNamed(Ksplash);

handleMessage(event1!, context);
}
print("Launched from terminated state");

}
});

FirebaseMessaging.onMessageOpenedApp.listen((event) {
print('identi');
// NotificationServices notificationServices=NotificationServices();
// notificationServices.firebaseInit();
// notificationServices.showNotification(event);
if(event.notification!=null){
if (event.notification!.title.toString()=='New Order'){

  Get.offNamed(Kneworderscreen, arguments: event.data);
}
else{
handleMessage(event, context);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant