Kotlin · JVM 17+ · Android API 21+ · Apache 2.0

CalDAV sync for Kotlin

A CalDAV client with offline sync and conflict resolution. Works with iCloud, Nextcloud, and other CalDAV servers.

Get Started View on GitHub
build.gradle.kts
// Add to your dependencies
implementation("org.onekash:icaldav-client:2.3.1")

// Optional: Sync engine with offline support
implementation("org.onekash:icaldav-sync:2.3.1")

// Optional: Android CalendarContract mapper (API 21+)
implementation("org.onekash:icaldav-android:2.3.1")

Requires JVM 17+ and Kotlin 1.9+. Android module requires API 21+.

Features

📅

RFC 5545 Compliant

Full iCalendar parsing and generation. Recurring events, timezones, alarms, and more.

🔄

Offline Sync

Queue changes offline and sync when connected. Automatic conflict resolution.

🔍

Auto Discovery

Automatic CalDAV server and calendar discovery. Just provide credentials.

☁️

Provider Support

Tested with iCloud, Nextcloud, Radicale, Baikal. Handles server quirks.

Type-Safe Results

Sealed DavResult class for exhaustive error handling. No exceptions.

🧩

Modular

Use just the parser, just the client, or the full sync engine. Your choice.

📱

Android Native

Map iCalDAV events to Android CalendarContract. Seamless system calendar integration.

Quick Start

Kotlin
val client = CalDavClient.forProvider(
    serverUrl = "https://caldav.example.com",
    username = "user@example.com",
    password = "password"
)

val discovery = client.discoverAccount(serverUrl)
if (discovery is DavResult.Success) {
    val calendar = discovery.value.calendars.first()

    // Create event
    val event = ICalEvent(
        uid = UUID.randomUUID().toString(),
        summary = "Team Meeting",
        dtStart = ICalDateTime.fromInstant(Instant.now()),
        dtEnd = ICalDateTime.fromInstant(Instant.now().plus(1, ChronoUnit.HOURS))
    )
    client.createEvent(calendar.href, event)
}

Modules

Module Purpose
icaldav-core Parse and generate iCalendar (RFC 5545)
icaldav-client CalDAV/WebDAV client with discovery and CRUD
icaldav-sync Sync engine with offline support and conflict resolution
icaldav-android Android CalendarContract mapper (API 21+)

Tested Providers

iCloud

Full support

Nextcloud

Full support

Radicale

Full support

Baikal

Full support