Reputation: 1112
I have used firebase_messaging plugin for notifications, on both platforms notifications works fine,
However, I want to redirect user to specific screen on Notification click event. For Android side, it's working fine. But for IOS, it does not work if app is in background and is not terminated (Works fine if app is terminated).
Here's my code sample for notification integration:
_firebaseMessaging.configure(
onMessage: (Map<String, dynamic> message) async {
print("onMessage: $message");
gotoTempPage();
},
onLaunch: (Map<String, dynamic> message) async {
print("onLaunch: $message");
gotoTempPage();
},
onResume: (Map<String, dynamic> message) async {
print("onResume: $message");
gotoTempPage();
},
);
I am using plugin version firebase_messaging: ^6.0.9
, and flutter version v1.12.13+hotfix.5
Already referred these issues 935, 1757, 1677 but nothing helped me.
Upvotes: 3
Views: 3521
Reputation: 167
Hi i had exactly the same issue. So, according to the current documentation of the plugin (firebase_messaging), you should make some modification to your Appdelegate.m/Appdelegate.swift file.
This modification is the problem.
Remove the following code from your AppDelegate.swift
or similar in AppDelegate.m
if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
}
It seems to be a bug or issue with this version of firebase_messaging (6.0.9) as in here
Upvotes: 3