EgorBo / Toasts.Forms.Plugin

A plugin for Xamarin and Windows - it unites Crouton (Android), TWMessageBarManager (iOS) and my toast notificator for WP8.
MIT License
278 stars 84 forks source link

ReceivedRemoteNotification not triggered after first notification received (iOS Xamarin Form) #164

Open LeonardoPatti opened 6 years ago

LeonardoPatti commented 6 years ago

I use the Plugin with Xamarin form on iOS, I use the override method "ReceivedRemoteNotification(UIApplication application, NSDictionary userInfo)" in AppDelegate to process the push Notifications. I notice that the first notification trigger this method and call the correct code to show the toast, but after the first notification, the toast still showed but this method is not triggered. Maybe the plugging overwrite it after the first notification?

sachin031 commented 6 years ago

Facing same issue.

bombez commented 5 years ago

Hi, I've discover that

public INotificationResult Notify(INotificationOptions options)
{
var notificationCenter = UNUserNotificationCenter.Current;
...
notificationCenter.Delegate = new UserNotificationCenterDelegate(id, (identifier, notificationResult) =>
{
                lock (_lock)
                    if (_resetEvents?.ContainsKey(identifier) == true && _eventResult?.ContainsKey(identifier) == false)
                    {
                        _eventResult.Add(identifier, notificationResult);
                        _resetEvents[identifier].Set();
                    }
            }, options.ClearFromHistory, options.AllowTapInNotificationCenter);
}

that override the behave of the Notification Center when notify method is called.