Plugin.LocalNotification icon indicating copy to clipboard operation
Plugin.LocalNotification copied to clipboard

Current_NotificationReceived fires twice when two NotificationRequests are active at the same time

Open andy-shindey opened this issue 2 years ago • 2 comments

Describe the bug Current_NotificationReceived fires twice when two NotificationRequests are active at the same time. When there are two reminders with two different NotificationId, active at the same time with same interval but started at different time. I get Current_NotificationReceived event twice for a given NotificationId.

To Reproduce Steps to reproduce the behavior:

  1. Create first NotificationRequest
  2. Wait for sometime
  3. Create second NotificationRequest
  4. At first reminder, See error

Expected behavior Expect Current_NotificationReceived once for each NotificationId.

Screenshots If applicable, add screenshots to help explain your problem.

Platform (please complete the following information):

  • OS: Android 10, Windows 10 and Visual Studio 2022
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Moto g7
  • OS: Android
  • Version 10

Additional context Snap of my code var NotifySchedule = new NotificationRequestSchedule { NotifyTime = DateTime.Now.AddSeconds(30), RepeatType = NotificationRepeat.TimeInterval, NotifyRepeatInterval = TimeSpan.FromSeconds(20), };

        var NotifyMe = new NotificationRequest
        {
            NotificationId = NoticeID,
            Subtitle = SubTitle,
            Title = Title,
            Description = Description,
            BadgeNumber = 1,
            //Repeats = NotificationRepeat.Daily,
            //NotifyTime = (DateTime.Today + ToDoNagMeTimeDv),
            Schedule = NotifySchedule,
            ReturningData = "Notification Tapped",
            CategoryType = NotificationCategoryType.Reminder,

            Android =
            {                    
                //VisibilityType = AndroidVisibilityType.Private,
                ChannelId = "MainChannel",
                IconSmallName =
                {
                    ResourceName = "iconpill",
                },
                Color =
                {
                    Argb = System.Drawing.Color.Red.ToArgb(),
                },
                //Priority = AndroidNotificationPriority.Default,
            },
        };
        NotificationCenter.Current.Show(NotifyMe);
        NotificationMessageDv = NotifySchedule.NotifyTime.ToString();

        NotificationCenter.Current.NotificationTapped += Current_NotificationTapped;
        NotificationCenter.Current.NotificationReceived += Current_NotificationReceived;

andy-shindey avatar May 31 '22 04:05 andy-shindey

@andy-shindey Can you please attach a sample project?

thudugala avatar Jun 01 '22 03:06 thudugala

Sure, give me a couple of days to recreate the sample as close as possible to my project structure.

andy-shindey avatar Jun 01 '22 11:06 andy-shindey