CalendarNotification icon indicating copy to clipboard operation
CalendarNotification copied to clipboard

Notifications re-appear after dismissing

Open woj-tek opened this issue 7 years ago • 17 comments

I have a couple of morning tasks. They show up correctly at about 6:00, 7:00 and so forth. I dismiss them when I'm done and... they re-appear around noon. at 12 I have a task that enables System-wide synchronisation (that's the only correlation I can think of). It started happening since about 1-2 weeks ago.

woj-tek avatar Oct 25 '17 15:10 woj-tek

A little bit more information -- it looks like that for some reason after enabling synchronisation the notifications for all events to the moment of re-enabling synchronisation are being displayed, i.e. chain of events:

  • disable synchronisation
  • notification1
  • dismiss notification1
  • notification2
  • dismiss notification2
  • notification3
  • dismiss notification3
  • enable synchronisation
  • notification1, notification2, notification3 (at the same time)

woj-tek avatar Nov 03 '17 14:11 woj-tek

I also notice this behaviour. I cannot detect a specific pattern but generally a day later (or more) I will receive a repeat of a dismissed notification. Sometimes multiple times.

Running MIUI 9.0 Stable 9.0.5.0(NCFCNEI) Android 7.0 Kernel Ver 3.18.31-perf-g5b30ef0

discoball78 avatar Feb 23 '18 06:02 discoball78

I have the same problem here.

  • Are you guys syncing your calendar to a server? (I use the DAVdroid app or google calendar)
  • Do you have other devices or applications that show notifications for the same calendar events?

In my case it seems to be caused by multiple devices accessing the same calendar.

It seems like CalendarNotification does not write any changes to the caldav-event when I dismiss the notification. So other devices accessing the same calendar (like my windows laptop) will not be aware that the notification has already been dismissed on android. So the other devices will also show you a notification for the same event. But after you dismiss the notification here, they will usually write the fact that the notification has been dismissed into the calendar-event. From now on all applications should know the notification for this event has already been dismissed and you should never see a notification for this event again. But this change seems to confuse CalendarNotification. I guess it just realizes the event has been changed - without understanding the intention of the change. So it notifies again to make sure you are aware something has been changed...

DonEstefan avatar Mar 10 '18 15:03 DonEstefan

I'm syncing to google calendar and davdroid. Only events from google calendar seems to appear again. I'm also syncing same calendars on macOS (but not showing any notifications for that particular calendars/events). It was working OK and it started to misbehave recently again.

woj-tek avatar Mar 10 '18 16:03 woj-tek

I can confirm this behaviour: I use DAVdroid to synchronize my calendar with the laptop. Everytime after DAVdroid synchronized the calendar, I see all dismissed notifications again.

sphh avatar May 10 '18 08:05 sphh

Any ideas on how to solve this or are there alternatives? I would really like to be able to postpone or dismiss notifications and have it synced across devices. I'm also using DAVdroid. Slight difference to you guys: I just get two notifications within about 20 minutes for the same event without having even opened the first one. There are no duplicate events or calendars that might cause this.

david-53111 avatar May 20 '18 08:05 david-53111

I also have this issue. I wonder if it's an issue with DAVdroid in some way. When I used CalDAV-Sync with Calendar Notification I would never get duplicates.

CaviaPorcellus avatar May 31 '18 17:05 CaviaPorcellus

I just installed version 4.0.7 via play store. It says "fixed suppport for webdav calenders -- events should not re-appear now". Unfortunately the fix is not working for me :( I'm still seeing events re-appear...

DonEstefan avatar Sep 14 '18 11:09 DonEstefan

I think I understand what is going on from my brief review of the code. Event alerts are loaded based on the calendar record state, in particular whether the record had been dismissed. The code does not check the event end time. I suspect that when the calendar is synced with an external source (Outlook.office365.com in my case) the dismissed flag is overwritten and the event is alerted on the next calendar scan (my WAG). If events that have already ended were ignored, this would go a long way to addressing my issue.

jscottnc avatar Apr 25 '19 15:04 jscottnc

I have hacked in a check for instanceEndTime > System.currentTimeMillis() and skipped adding the event to the alert list if false. I modified Calendar provider::getAlertByTime and CalendarIntents::intentForAction. So far I get alerts I expect and none for expired events. I have seen old events in the notification but not had the notification triggered by old events. I can live with that.

jscottnc avatar May 04 '19 18:05 jscottnc

~~In my case the problem was gone for several months (since late 2018) - but it came back in one of the releases in the last weeks...~~ I just realized that I'm still on Version 4.0.19-legacy. Seems like the I did not get any updates for a long time... I had to delete the app and reinstall via F-Droid.org to get the fixed version.

DonEstefan avatar Jun 21 '19 12:06 DonEstefan

@jscottnc would you consider doing a PR with your fix? It does seem like the root cause and maybe @quarck would consider merging it?

woj-tek avatar Sep 03 '19 18:09 woj-tek

Sounds like work (which I generally avoid). At the very least you will have to tell me what a PR is. John Scott [email protected] "You can't be a real country unless you have a beer and an airline. It helps if you have some kind of football team and some nuclear weapons, but at the very least, you need a beer."  --F. Zappa

On Tuesday, September 3, 2019, 02:49:09 PM EDT, Wojtek <[email protected]> wrote:  

@jscottnc would you consider doing a PR with your fix? It does seem like the root cause and maybe @quarck would consider merging it?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

jscottnc avatar Sep 03 '19 18:09 jscottnc

PR - Pull Request.

In a nutshell:

  • fork current repository
  • make changes in your repository
  • navigate to Pull Request section here (i.e. https://github.com/quarck/CalendarNotification/compare) and create PR with your changes.

woj-tek avatar Sep 05 '19 16:09 woj-tek

Had to dust off the git skills. Fortunately I did not need anything fancy and could use the cookbook to get me through. Fork created. Changes synced. Pull Request generated. Release the hounds!

https://github.com/jscottnc/CalendarNotification

jscottnc avatar Sep 05 '19 17:09 jscottnc

Thank you @jscottnc - now it's in the hands of @quarck

woj-tek avatar Sep 05 '19 21:09 woj-tek

Seems like the workaround from @jscottnc has been integrated in version 5.0.5 of the app. There is a new skip expired events option in the "Behavior" section of the settings. This should significantly reduce the problem. The option is disabled by default, because there are some implications you should be aware of. To my understanding this includes (but is not limited to):

  • some dismissed notifications might still re-appear - especially in situations with long event durations and short sync intervals with other devices
  • notifications might not show up at all - especially for short duration events (see https://github.com/quarck/CalendarNotification/pull/345#issuecomment-529153251)
  • if event and reminder are set to a time when the phone is shut off (e.g during night), then no corresponding notification will be shown when the phone starts

However, for me this is still a lot better than before and I'd like to thank everyone involved. It is much appreciated!!!

DonEstefan avatar Dec 15 '19 15:12 DonEstefan