koldfront

Syncronizing contacts and calendars with your own server, on Android #android

๐Ÿ•–๏ธŽ - 2014-09-14

I just spent 2ยฝ hours making my new Android phone sync using DAVdroid to radiCALe on my home server.

It took a while, because there are a couple of things you simply "have to know":

I am only sync'ing my web-based calender on the server in one direction (server to phone); this seems to just work. Addressbook will probably only be in the other direction (phone to server).

I managed to avoid sending my contacts to Google, by turning off all sync before creating the Google account (this is done in Settings/Data Usage top right menu "Auto-sync data"). After creating the account, I turned off wi-fi and mobile data - and then I reenabled Auto-sync data, and went to Settings/Accounts/Google and disabled sync for everything Google there. After that I could enable mobile data and wi-fi again.

The point here is for the email app to update Auto-sync data must be on, but if I turned it on again while there was a network connection available, my contacts would have been synced to the new Google account before I could disable syncing to it - thus the turn off wi-fi and mobile data "trick".

Phew.

Update: If you try setting up a DAVdroid account, and you get an "HTTP error: 500 internal server error", while radiCALe reports no problem in the log, double check the permissions/ownership of the files in /var/lib/radicale/collections/ For some reason one of the .props-files got root.root as owner.group, changing to radicale.radicale fixed the problem.

Also, if DAVdoid says there is in intermittent problem with syncing your calendars, check that your .ics-files have UID entries for all VEVENTS - they are apparently mandatory for DAVdroid.

Nice to read that people set up their own servers and use DAVdroid :-)

Some additions:

  1. For Radicale, all contacts are expected to be in the directory addressbook.vcf โ€“ one per file, so there's not a directory too much. Apparently, it also works when there are multiple contacts per file because Radicale is splitting the contacts itself.
  2. The same applies to events: one event per file is expected. That's how CalDAV works: each event is accessible (for reading, updating etc.) as a single resource (Radicale may split up the file to multiple virtual files like for the address book, but apparently it doesn't). Also, by the CalDAV spec, all members must be direct children of the collection.
  3. Also, by iCalendar RFC, all VEVENTs, VTODOs, VJOURNALs and VFREEBUSYs MUST contain a UID to uniquely identify the entry (like DAVdroid does).

- rfc2822 ๐Ÿ•ฅ๏ธŽ - 2014-10-19

+=

Thanks for the comments!

Android exports all contacts to one file so I didn't even think of splitting them, and most calendars I have seen also export many events to one VCALENDAR file - but it is nice to get an idea of why the "quirks" I observed might be.

UID: Ok, I have been to lazy to read the specs, I just went with how stuff looks in the real world, which is always risky (as is just going by the spec, of course :-)).

- Adam ๐Ÿ•ฅ๏ธŽ - 2014-10-19

+=

Are you saying the spec is the to to have each event as a separate file?

- Tom Russell ๐Ÿ•™๏ธŽ - 2017-08-09

+=

Add comment

To avoid spam many websites make you fill out a CAPTCHA, or log in via an account at a corporation such as Twitter, Facebook, Google or even Microsoft GitHub.

I have chosen to use a more old school method of spam prevention.

To post a comment here, you need to:

ยน Such as Thunderbird, Pan, slrn, tin or Gnus (part of Emacs).

Or, you can fill in this form:

+=