public final class CalendarContract extends Object
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.Calendars
table 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.Events
table 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 BaseColumns._ID
to link them with the event.CalendarContract.Instances
table 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.Attendees
table 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.Reminders
table 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
CalendarContract.CalendarColumns.MAX_REMINDERS
which is set by the Sync Adapter that owns
the given calendar. Reminders are specified in minutes before the event and
have a type.CalendarContract.ExtendedProperties
table 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
adaptersModifier and Type | Class and Description |
---|---|
static class |
CalendarContract.Attendees
Fields and helpers for interacting with Attendees.
|
protected static interface |
CalendarContract.AttendeesColumns
Columns from the Attendees table that other tables join into themselves.
|
static class |
CalendarContract.CalendarAlerts
Fields and helpers for accessing calendar alerts information.
|
protected static interface |
CalendarContract.CalendarAlertsColumns |
static class |
CalendarContract.CalendarCache
CalendarCache stores some settings for calendar including the current
time zone for the instances.
|
protected static interface |
CalendarContract.CalendarCacheColumns |
protected static interface |
CalendarContract.CalendarColumns
Columns specific to the Calendars Uri that other Uris can query.
|
static class |
CalendarContract.CalendarEntity
Class that represents a Calendar Entity.
|
static class |
CalendarContract.CalendarMetaData |
protected static interface |
CalendarContract.CalendarMetaDataColumns
A few Calendar globals are needed in the CalendarProvider for expanding
the Instances table and these are all stored in the first (and only) row
of the CalendarMetaData table.
|
static class |
CalendarContract.Calendars
Constants and helpers for the Calendars table, which contains details for
individual calendars.
|
protected static interface |
CalendarContract.CalendarSyncColumns
Generic columns for use by sync adapters.
|
static class |
CalendarContract.Colors
Fields for accessing colors available for a given account.
|
protected static interface |
CalendarContract.ColorsColumns |
static class |
CalendarContract.EventDays
Fields and helpers for querying for a list of days that contain events.
|
protected static interface |
CalendarContract.EventDaysColumns |
static class |
CalendarContract.Events
Constants and helpers for the Events table, which contains details for
individual events.
|
protected static interface |
CalendarContract.EventsColumns
Columns from the Events table that other tables join into themselves.
|
static class |
CalendarContract.EventsEntity
Class that represents an Event Entity.
|
static class |
CalendarContract.EventsRawTimes |
protected static interface |
CalendarContract.EventsRawTimesColumns
Columns from the EventsRawTimes table
|
static class |
CalendarContract.ExtendedProperties
Fields for accessing the Extended Properties.
|
protected static interface |
CalendarContract.ExtendedPropertiesColumns |
static class |
CalendarContract.Instances
Fields and helpers for interacting with Instances.
|
static class |
CalendarContract.Reminders
Fields and helpers for accessing reminders for an event.
|
protected static interface |
CalendarContract.RemindersColumns |
protected static interface |
CalendarContract.SyncColumns
Columns for Sync information used by Calendars and Events tables.
|
static class |
CalendarContract.SyncState
A table provided for sync adapters to use for storing private sync state data.
|
Modifier and Type | Field and Description |
---|---|
static String |
ACCOUNT_TYPE_LOCAL
A special account type for calendars not associated with any account.
|
static String |
ACTION_EVENT_REMINDER
Broadcast Action: This is the intent that gets fired when an alarm
notification needs to be posted for a reminder.
|
static String |
ACTION_HANDLE_CUSTOM_EVENT
Activity Action: Display the event to the user in the custom app as
specified in
CalendarContract.EventsColumns.CUSTOM_APP_PACKAGE . |
static String |
AUTHORITY
This authority is used for writing to or querying from the calendar
provider.
|
static String |
CALLER_IS_SYNCADAPTER
An optional insert, update or delete URI parameter that allows the caller
to specify that it is a sync adapter.
|
static Uri |
CONTENT_URI
The content:// style URL for the top-level calendar authority
|
static String |
EXTRA_CUSTOM_APP_URI
Intent Extras key:
CalendarContract.EventsColumns.CUSTOM_APP_URI for the event in
the ACTION_HANDLE_CUSTOM_EVENT intent |
static String |
EXTRA_EVENT_ALL_DAY
Intent Extras key: When creating an event, set this to true to create an
all-day event by default
|
static String |
EXTRA_EVENT_BEGIN_TIME
Intent Extras key: The start time of an event or an instance of a
recurring event.
|
static String |
EXTRA_EVENT_END_TIME
Intent Extras key: The end time of an event or an instance of a recurring
event.
|
public static final String ACTION_EVENT_REMINDER
public static final String ACTION_HANDLE_CUSTOM_EVENT
CalendarContract.EventsColumns.CUSTOM_APP_PACKAGE
. The custom app
will be started via Activity.startActivityForResult(Intent, int)
and it should call Activity.setResult(int)
with
Activity.RESULT_OK
or Activity.RESULT_CANCELED
to
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>
Input: Intent.getData()
has the event URI. The extra
EXTRA_EVENT_BEGIN_TIME
has the start time of the instance. The
extra EXTRA_CUSTOM_APP_URI
will have the
CalendarContract.EventsColumns.CUSTOM_APP_URI
.
Output: Activity.RESULT_OK
if this was handled; otherwise
Activity.RESULT_CANCELED
public static final String EXTRA_CUSTOM_APP_URI
CalendarContract.EventsColumns.CUSTOM_APP_URI
for the event in
the ACTION_HANDLE_CUSTOM_EVENT
intentpublic static final String EXTRA_EVENT_BEGIN_TIME
public static final String EXTRA_EVENT_END_TIME
public static final String EXTRA_EVENT_ALL_DAY
public static final String AUTHORITY
public static final Uri CONTENT_URI
public static final String CALLER_IS_SYNCADAPTER
ContentResolver.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
CalendarContract.SyncColumns.ACCOUNT_NAME
and CalendarContract.SyncColumns.ACCOUNT_TYPE
as
query parameters.Uri.Builder#appendQueryParameter(java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final String ACCOUNT_TYPE_LOCAL
SyncColumns#ACCOUNT_TYPE
,
Constant Field Values