Methods for adding events to the device calendar.

These methods always show the system calendar UI prefilled with the event data, so the user reviews and confirms every event. Because of that, no calendar permission is requested and none needs to be declared by the host app.

Notice for App Developers

To use isAvailable some configuration in the native app is needed

  • Android:

    • Add to AndroidManifest.xml, so the calendar app stays visible under the package visibility rules of Android 11 and higher:
<manifest [...]>
<queries>
<intent>
<action android:name="android.intent.action.INSERT" />
<data android:mimeType="vnd.android.cursor.dir/event" />
</intent>
</queries>
[...]
</manifest>
  • IOS:

    • No configuration and no usage description are needed. Adding an event requires iOS 17 or newer, where the system event editor runs outside the app and therefore needs no permission. On iOS 16 and below isAvailable reports false and addEvent rejects with calendar.unavailable.

Hierarchy

  • Calendar

Methods

  • Opens the system calendar UI prefilled with the given event, so the user can review and save it.

    🚨 The returned promise resolves as soon as the calendar UI is shown, not when the user saves the event. There is no way to know whether the event was saved: Android reports a cancelled result even when the user saves, so neither platform exposes the outcome.

    Rejects with calendar.unavailable when no calendar UI can be shown.

    Example:

    await Eitri.calendar.addEvent({
    title: "Team meeting",
    startDate: "2026-08-03T14:00:00.000Z",
    endDate: "2026-08-03T15:00:00.000Z",
    location: "Office",
    notes: "Bring the quarterly report",
    recurrenceRule: "FREQ=WEEKLY;COUNT=10"
    })

    Compatibility Control

    • API LEVEL 38 - Functionality added

    Parameters

    Returns Promise<void>

  • Checks whether the device can show a calendar UI to add an event, so the eitri-app can hide the feature when it is not usable.

    Returns false when no calendar app is installed on Android, and on iOS 16 and below, where adding an event is not supported.

    Example:

    if (await Eitri.calendar.isAvailable()) {
    // show the "add to calendar" button
    }

    Compatibility Control

    • API LEVEL 38 - Functionality added

    Returns Promise<boolean>

Generated using TypeDoc