Simple-Calendar icon indicating copy to clipboard operation
Simple-Calendar copied to clipboard

CalDAV calendars not refreshed unless I launch Google's app!

Open llevrel opened this issue 3 years ago • 24 comments

This is Simple Calendar v 6.13.7 Pro, from F-droid. My setup is like this:

  • on my laptop, Radicale as CardDAV & CalDAV server, Evolution as client,
  • on the phone (Android 8.1.0), DAVx5 to sync and Simple Calendar Pro as client.

When I add an event to the server with Evolution, then synchronize the phone with DAVx5, then hit the synchronization menu entry in Simple Calendar, the new event doesn't show up. At this moment, if I open the stock Android calendar app, the event is there, and back to Simple Calendar it suddenly appears!

(The comment dated Jul 7, 2020 in bug #921 reports a very similar problem.)

When I installed Simple Calendar I faced something similar. I had installed and synched DAVx5 beforehand. In Simple Calendar I activated CalDAV in settings, turned on all calendars, synched... no effect! I was getting crazy but it finally worked by re-synching DAVx5 although there were no new events to synch from the server.

Last word: I had been using Simple Calendar for ~6 months already (can't remember which version) and was so happy with it that I thought "now I can disable the stock Android app". Rebooted my phone and... it didn't boot anymore! I had to factory-reset it... What an irony!

llevrel avatar Jun 03 '21 18:06 llevrel

Some testing.

First test:

  1. stop Google Agenda and Simple Calendar in Settings > Apps
  2. launch DAVx5 synch, wait until it finishes
  3. launch Simple Calendar, launch synch: I get the "Synch in progress" info-balloon, but it never finishes (I can wait many minutes and nothing happens)
  4. launch again DAVx5 synch (although no new event on the server), I quickly get SC's "Synch completed" info-balloon, although it's still in background (the message displays on top of DAVx5)

Second test: Same as first, except SC is not stopped at step 1. It seems the problem is the same. ("seems" because I tried only once)

Third test: Steps 1-3 same as first, but 4. launch Google Agenda. The events are correct there. The synch in SC is still pending, until I launch DAVx5 synch. So here Google Agenda seems not to help. /or/ 4. launch Google Agenda. Launch DAVx5 synch, wait for it to complete. Then launch SC and synch: the synch will eventually complete; it seems to take a bit of time. Maybe Google Agenda is somehow fiddling with the event database?

The first test is reliable, I reproduced it several times. The other tests have been tried only once. Let me know if I can help more. Thanks!

llevrel avatar Jun 04 '21 12:06 llevrel

Same problem here!

The only thing that works for me for the sync is unselecting and selecting my CalDav calendar in "Settings -> CALDAV -> Manage synced calendars" option. Then, the "Syncing.." and "Sync completed" toasts appears. There is no other way to sync it successfully.

I hope it helps on the bug research and let me know if i can help too!

iansangines avatar Jun 08 '21 14:06 iansangines

Same here. Very unintuitive to have to turn the calendars on in a caldav section when I don't want to use Simple Calendar caldav functionality (I'm using davx5 too). Glad I found this bug though. Otherwise I don't know if I would've figured it out.

TheShanMan avatar Jul 03 '22 02:07 TheShanMan

+1

ltguillaume avatar Aug 23 '22 16:08 ltguillaume

Same here. Very unintuitive to have to turn the calendars on in a caldav section when I don't want to use Simple Calendar caldav functionality (I'm using davx5 too). Glad I found this bug though. Otherwise I don't know if I would've figured it out.

AFAIK, SC doesn't do what DAVx5 does. DAVx5 synchronises the so-called Calendar Storage in your phone with some server. SC's "CalDAV" functionality consists in using the phone's Calendar Storage. I guess it's called CalDAV as a shorthand, but the Calendar Storage contents may come to the phone by any means, CalDAV or not (e.g. Google calendars are there too). See https://www.davx5.com/manual/_images/how_davx5_interacts_with_other_components.png

@TheShanMan @ltGuillaume did you try and run my tests?

llevrel avatar Aug 24 '22 15:08 llevrel

@llevrel That all isn't applicable for me, for the following reasons:

  1. I don't have "Google Calendar" installed.
  2. I did try Etar and the calendar app on a LG G7:
  • Etar never has these issues.
  • The CalDAV calendar did not show up in SC, not even after a reboot. Only after starting the LG calendar app, SC finally listed the CalDAV calendar.
  • Only after opening the LG calendar app, SC started showing the entries from the synced calendar. Afterwards, it stopped syncing afaon, even though DAVx5 was syncing properly. Again, after starting the LG calendar app, SC showed new entries
  • Simple Calendar never synced on the LG device (with DAVx5), not even after a reboot. New events created in SC didn't get synced either, even after manually syncing with DAVx5.

ltguillaume avatar Aug 24 '22 17:08 ltguillaume

@llevrel I'm trying to reproduce the first test:

  1. Install DAVx5 and add a calendar "Personal"
  2. Enable the "Personal" calendar in SC's settings
  3. Sync in DAVx5 and then in SC, everything works and the events are there.
  4. Force stop Google Calendar & SC
  5. Add a new event on the server
  6. Sync in DAVx5
  7. Open SC and refresh, the new event is there without any delay

Am I doing something wrong?

naveensingh avatar Aug 24 '22 19:08 naveensingh

@llevrel I'm trying to reproduce the first test:

  1. Install DAVx5 and add a calendar "Personal"
  2. Enable the "Personal" calendar in SC's settings
  3. Sync in DAVx5 and then in SC, everything works and the events are there.
  4. Force stop Google Calendar & SC
  5. Add a new event on the server
  6. Sync in DAVx5
  7. Open SC and refresh, the new event is there without any delay

Am I doing something wrong?

Seems no. What version do you use? The bug may have been corrected...

llevrel avatar Aug 25 '22 10:08 llevrel

I've found it to be device specific, or perhaps just Android version specific as to whether it works or not. Either way, it is definitely not fixed yet.

ltguillaume avatar Aug 25 '22 13:08 ltguillaume

@llevrel @ltGuillaume

I'm on the latest version but I'll try with the older version you mentioned.

Q. What devices you guys are using?

I'm interested in the installed OS. Is it MIUI, Funtouch OS or something like that (heavily skinned)?

naveensingh avatar Aug 25 '22 16:08 naveensingh

Q. What devices you guys are using?

I'm interested in the installed OS. Is it MIUI, Funtouch OS or something like that (heavily skinned)?

This is a vanilla Android 8.1.0 (phone is "echo Feeling", kind of noname) with stock Google apps.

llevrel avatar Aug 25 '22 17:08 llevrel

FWIW (you didn't ask me but maybe it's helpful info), I have a moto g7 with rooted lineageos 19.1 (android 12) and microg (no gapps).

TheShanMan avatar Aug 25 '22 18:08 TheShanMan

thanks to y'all I was able to reproduce this bug on a somewhat old device with Android 9 (MIUI 11), the bug indeed is device/ROM specific

I will share a test APK once I have a fix :+1:

naveensingh avatar Aug 26 '22 13:08 naveensingh

AFAIK, SC doesn't do what DAVx5 does. DAVx5 synchronises the so-called Calendar Storage in your phone with some server. SC's "CalDAV" functionality consists in using the phone's Calendar Storage.

True. Simple calendar can only fetch what is already there in the android calendar database (which isn't working properly) and request sync adapters (DAVx5, Google calendar) to update the database with new events from the server. SC can't really fetch events from the server itself, a working (not force stopped) sync adapter service must be there for CalDAV synchronization to work properly.

naveensingh avatar Aug 26 '22 16:08 naveensingh

If anyone's up for testing here's a test APK that should fix this issue

naveensingh avatar Aug 26 '22 16:08 naveensingh

Just tried this build. It seems to just fail to trigger a sync by DAVx5 when I use the menu item to do so, even though the toast messages state sync started/finished. Only from within DAVx5 I can reliably trigger a sync.

But I also started to see this behavior in Etar all of a sudden. It might be related to DAVx5 then, even though it did work on other devices. I suppose I'll have to dig into DAVx5 logs and/or logcat when I have time...

ltguillaume avatar Sep 02 '22 13:09 ltguillaume

Hi! @ltGuillaume

As mentioned before, a working (not stopped) sync adapter service must be there for CalDAV synchronization to work properly. It's possible that the device (ROM) you are on has a battery saver feature that is restricting this background invocation

naveensingh avatar Sep 02 '22 13:09 naveensingh

@Naveen3Singh DAVx5 is excluded from that...

ltguillaume avatar Sep 02 '22 15:09 ltguillaume

I see the same issues on an Android 13 device. How can I help to solve this issue once and for all? A calendar app with unreliable synchronization is a calendar app that will be uninstalled by many.

ltguillaume avatar Aug 31 '23 10:08 ltguillaume

@ltguillaume

Hi!

(This is a quick reply, I'll be back later)

What device are you using now? Can you reproduce it reliably? During my tests, when events aren't refreshed in SC, they aren't refreshed in Etar either. Can you check and confirm (again) that Etar is working and SC is not with your new device? (A recording would be nice)

Thanks for tagging those related issues.

naveensingh avatar Aug 31 '23 10:08 naveensingh

Not my devices, so it will take some time before I have another example. I've stopped using SC altogether, primarily because of all the sync issues.

ltguillaume avatar Aug 31 '23 10:08 ltguillaume

But isn't there a debug version I could run, so I can provide you with some proper information, other than just saying "yeah it still won't work properly here, even though other calendar apps are working fine"?

Or would there be anything I can logcat?

ltguillaume avatar Sep 03 '23 21:09 ltguillaume

I'll send you a debug build with toasts and some log statements so we can check what triggered and what didn't.

naveensingh avatar Sep 04 '23 08:09 naveensingh

Alright, here's an APK: https://github.com/naveensingh/Simple-Calendar/releases/download/test_caldav_sync/calendar-prepaid-debug.apk

How to test:

  1. Install the APK from the link above
  2. Enable CalDAV sync and refresh CalDAV calendars from the options menu.
  3. Once the sync is finished, create a new calendar event in your other remote client (say Google's calendar on the web)
  4. In the simple calendar, again trigger CalDAV refresh once or twice and wait for the sync to finish.
  5. If the new event is nowhere to be found, go to some other calendar app where sync is known to work properly (Etar?) and trigger a sync there, and wait for the sync to finish. Check if the new event is available there now (this is important).
  6. Reopen Simple Calendar and check if the new event is available now.

Once the issue is successfully reproduced (steps 5 and 6), from the options menu, tap on "Share logs" and share it here or send it to me directly (just select your email client when sharing). Note that the logs might expose your synchronized email and CalDAV calendars.

(Like before, I can reliably reproduce THIS issue with Simple Calendar but I can reliably reproduce it with other calendars too on a Samsung with Android 13. Events aren't refreshed in any of my calendar apps unless I trigger a refresh in Google's Calendar app)

Note: This does not include any fixes or changes other than a few logs and toasts to address this issue. The APK is compiled against this branch on my fork.

naveensingh avatar Sep 06 '23 04:09 naveensingh