I am having quite a difficult time with something that I think should be easy, so I don’t know what I am missing if anyone knows. I am using the plugin Plugin.FirebasePushNotifications to receive FCM notification+data payloads on my .NET 9 MAUI app targeting Android and iOS.
I am having trouble trying to execute code when the user taps on a notification in the notification center on iOS devices, both when the app is backgrounded and when killed. I have unsuccesfully tried subscribing to the NotificationOpened event, first in a service and now in App.xaml.cs like:
public App(IFirebasePushNotification firebasePushNotification, [other services]){
_firebasePushNotification.NotificationOpened += onNotificationOpened;
[...]}
private async void onNotificationOpened(object sender, FirebasePushNotificationDataEventArgs e)
{
await _navigationService.GoToNotificationsView();
}
But this block of code never seems to run even when the notification is tapped. On Android devices I managed to implement this by catching the intents on the MainActivity, but I’ve also had no luck implementing the same on the AppDelegate overriding FinishedLaunching() checking for options.ContainsKey(UIApplication.LaunchOptionsRemoteNotificationKey)) and exporting userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler: .
Anyone knows what the correct way to do this in MAUI for iOS devices is?