Exemplo n.º 1
0
        public async void RemoveSystemToastNotificationIfExist()
        {
            IReadOnlyList <UserNotification> notifications = await NotificationListener.GetNotificationsAsync(NotificationKinds.Toast);

            UserNotification notification = notifications.FirstOrDefault(x =>
            {
                try
                {
                    return(x.AppInfo.AppUserModelId == WINDOWS_SYSTEM_TOAST_CALLING);
                }
                //That may happens when notifications come from non-UWP app, like MobileShell
                catch
                {
                    return(false);
                }
            });

            if (notification != null)
            {
                NotificationListener.RemoveNotification(notification.Id);
            }
        }