The contract between the calendar provider and applications. Contains definitions for the supported URIs and data columns.
CalendarContract defines the data model of calendar and event related information. This data is stored in a number of tables:
CalendarContract.Calendarstable holds the calendar specific information. Each row in this table contains the details for a single calendar, such as the name, color, sync info, etc.
CalendarContract.Eventstable holds the event specific information. Each row in this table has the info for a single event. It contains information such as event title, location, start time, end time, etc. The event can occur one-time or can recur multiple times. Attendees, reminders, and extended properties are stored on separate tables and reference the
_IDto link them with the event.
CalendarContract.Instancestable holds the start and end time for occurrences of an event. Each row in this table represents a single occurrence. For one-time events there will be a 1:1 mapping of instances to events. For recurring events, multiple rows will automatically be generated which correspond to multiple occurrences of that event.
CalendarContract.Attendeestable holds the event attendee or guest information. Each row represents a single guest of an event. It specifies the type of guest they are and their attendance response for the event.
CalendarContract.Reminderstable holds the alert/notification data. Each row represents a single alert for an event. An event can have multiple reminders. The number of reminders per event is specified in
MAX_REMINDERSwhich is set by the Sync Adapter that owns the given calendar. Reminders are specified in minutes before the event and have a type.
CalendarContract.ExtendedPropertiestable holds opaque data fields used by the sync adapter. The provider takes no action with items in this table except to delete them when their related events are deleted.
Other tables include:
CalendarContract.SyncState, which contains free-form data maintained by the sync adapters
|CalendarContract.Attendees||Fields and helpers for interacting with Attendees.|
|CalendarContract.AttendeesColumns||Columns from the Attendees table that other tables join into themselves.|
|CalendarContract.CalendarAlerts||Fields and helpers for accessing calendar alerts information.|
|CalendarContract.CalendarCache||CalendarCache stores some settings for calendar including the current time zone for the instances.|
|CalendarContract.CalendarColumns||Columns specific to the Calendars Uri that other Uris can query.|
|CalendarContract.CalendarEntity||Class that represents a Calendar Entity.|
|CalendarContract.CalendarSyncColumns||Generic columns for use by sync adapters.|
|CalendarContract.Calendars||Constants and helpers for the Calendars table, which contains details for individual calendars.|
|CalendarContract.Colors||Fields for accessing colors available for a given account.|
|CalendarContract.EventDays||Fields and helpers for querying for a list of days that contain events.|
|CalendarContract.Events||Constants and helpers for the Events table, which contains details for individual events.|
|CalendarContract.EventsColumns||Columns from the Events table that other tables join into themselves.|
|CalendarContract.EventsEntity||Class that represents an Event Entity.|
|CalendarContract.ExtendedProperties||Fields for accessing the Extended Properties.|
|CalendarContract.Instances||Fields and helpers for interacting with Instances.|
|CalendarContract.Reminders||Fields and helpers for accessing reminders for an event.|
|CalendarContract.SyncColumns||Columns for Sync information used by Calendars and Events tables.|
|CalendarContract.SyncState||A table provided for sync adapters to use for storing private sync state data.|
|String||ACCOUNT_TYPE_LOCAL||A special account type for calendars not associated with any account.|
|String||ACTION_EVENT_REMINDER||Broadcast Action: This is the intent that gets fired when an alarm notification needs to be posted for a reminder.|
|String||ACTION_HANDLE_CUSTOM_EVENT||Activity Action: Display the event to the user in the custom app as
|String||AUTHORITY||This authority is used for writing to or querying from the calendar provider.|
|String||CALLER_IS_SYNCADAPTER||An optional insert, update or delete URI parameter that allows the caller to specify that it is a sync adapter.|
|String||EXTRA_CUSTOM_APP_URI||Intent Extras key:
|String||EXTRA_EVENT_ALL_DAY||Intent Extras key: When creating an event, set this to true to create an all-day event by default|
|String||EXTRA_EVENT_BEGIN_TIME||Intent Extras key: The start time of an event or an instance of a recurring event.|
|String||EXTRA_EVENT_END_TIME||Intent Extras key: The end time of an event or an instance of a recurring event.|
|CONTENT_URI||The content:// style URL for the top-level calendar authority|
A special account type for calendars not associated with any account. Normally calendars that do not match an account on the device will be removed. Setting the account_type on a calendar to this will prevent it from being wiped if it does not match an existing account.
Broadcast Action: This is the intent that gets fired when an alarm notification needs to be posted for a reminder.
Activity Action: Display the event to the user in the custom app as
CUSTOM_APP_PACKAGE. The custom app
will be started via
and it should call
acknowledge whether the action was handled or not.
The custom app should have an intent filter like the following:
<intent-filter> <action android:name="android.provider.calendar.action.HANDLE_CUSTOM_EVENT" /> <category android:name="android.intent.category.DEFAULT" /> <data android:mimeType="vnd.android.cursor.item/event" /> </intent-filter>
This authority is used for writing to or querying from the calendar provider. Note: This is set at first run and cannot be changed without breaking apps that access the provider.
An optional insert, update or delete URI parameter that allows the caller
to specify that it is a sync adapter. The default value is false. If set
to true, the modified row is not marked as "dirty" (needs to be synced)
and when the provider calls
notifyChange(android.net.Uri, android.database.ContentObserver, boolean)
, the third parameter "syncToNetwork" is set to false. Furthermore, if
set to true, the caller must also include
Intent Extras key: When creating an event, set this to true to create an all-day event by default
Intent Extras key: The start time of an event or an instance of a recurring event. (milliseconds since epoch)
Intent Extras key: The end time of an event or an instance of a recurring event. (milliseconds since epoch)
The content:// style URL for the top-level calendar authority