2
votes

I am have implemented the latest Firebase Messaging 5.0.4 in my Flutter app.

However I have noticed on iOS it does not work as expected. It is implemented as per below:

_firebaseMessaging.configure(
  onMessage: (Map<String, dynamic> message) async {
    print("onMessage: $message");
    _showItemDialog(message);
  },
  onLaunch: (Map<String, dynamic> message) async {
    print("onLaunch: $message");
    _navigateToPage(message);
  },
  onResume: (Map<String, dynamic> message) async {
    print("onResume: $message");
    _navigateToPage(message);
  },
);

Especially the onLaunch and onResume ones are a problem.

On iOS the onLaunch and onResume are fired when the app is in the background or terminated when you click on a received notification. In the console I can also see the information printed with all the information attached to "message" however the functions below the print-statements are not performed at all. On Android it work as you would expect. Information is printed to the console and the below function is performed.

1

1 Answers

0
votes

I am not sure what happened but it seems to work now. However I have noticed that Google handles notifications a bit different than Apple. The data is slightly different in a push notification.