CalendarContract.Events
public
static
final
class
CalendarContract.Events
extends Object
implements
BaseColumns,
CalendarContract.SyncColumns,
CalendarContract.EventsColumns,
CalendarContract.CalendarColumns
java.lang.Object | |
↳ | android.provider.CalendarContract.Events |
Constants and helpers for the Events table, which contains details for individual events.
Operations
All operations can be done either as an app or as a sync adapter. To perform an operation as a sync adapterCalendarContract.CALLER_IS_SYNCADAPTER
should be set to true and
CalendarContract.SyncColumns.ACCOUNT_NAME
and CalendarContract.SyncColumns.ACCOUNT_TYPE
must be set in the Uri
parameters. See
Uri.Builder#appendQueryParameter(java.lang.String, java.lang.String)
for details on adding parameters. Sync adapters have write access to more
columns but are restricted to a single account at a time.
- Insert
- When inserting a new event the following fields must be included:
- dtstart
- dtend if the event is non-recurring
- duration if the event is recurring
- rrule or rdate if the event is recurring
- eventTimezone
- a calendar_id
- Update
- To perform an update of an Event the
Events#_ID
of the event should be provided either as an appended id to the Uri (ContentUris#withAppendedId
) or as the first selection item--the selection should start with "_id=?" and the first selectionArg should be the _id of the event. Updates may also be done using a selection and no id. Updating an event must respect the same rules as inserting and is further restricted in the fields that can be written. See the section on Writing to Events. - Delete
- Events can be deleted either by the
Events#_ID
as an appended id on the Uri or using any standard selection. If an appended id is used a selection is not allowed. There are two versions of delete: as an app and as a sync adapter. An app delete will set the deleted column on an event and remove all instances of that event. A sync adapter delete will remove the event from the database and all associated data. - Query
- Querying the Events table will get you all information about a set of
events except their reminders, attendees, and extended properties. There
will be one row returned for each event that matches the query selection,
or at most a single row if the
Events#_ID
is appended to the Uri. Recurring events will only return a single row regardless of the number of times that event repeats.
Writing to Events
There are further restrictions on all Updates and Inserts in the Events table:- If allDay is set to 1 eventTimezone must be "UTC" and the time must correspond to a midnight boundary.
- Exceptions are not allowed to recur. If rrule or rdate is not empty, original_id and original_sync_id must be empty.
- In general a calendar_id should not be modified after insertion. This is not explicitly forbidden but many sync adapters will not behave in an expected way if the calendar_id is modified.
CalendarContract.EventsColumns.CALENDAR_ID
CalendarContract.EventsColumns.ORGANIZER
CalendarContract.EventsColumns.TITLE
CalendarContract.EventsColumns.EVENT_LOCATION
CalendarContract.EventsColumns.DESCRIPTION
CalendarContract.EventsColumns.EVENT_COLOR
CalendarContract.EventsColumns.DTSTART
CalendarContract.EventsColumns.DTEND
CalendarContract.EventsColumns.EVENT_TIMEZONE
CalendarContract.EventsColumns.EVENT_END_TIMEZONE
CalendarContract.EventsColumns.DURATION
CalendarContract.EventsColumns.ALL_DAY
CalendarContract.EventsColumns.RRULE
CalendarContract.EventsColumns.RDATE
CalendarContract.EventsColumns.EXRULE
CalendarContract.EventsColumns.EXDATE
CalendarContract.EventsColumns.ORIGINAL_ID
CalendarContract.EventsColumns.ORIGINAL_SYNC_ID
CalendarContract.EventsColumns.ORIGINAL_INSTANCE_TIME
CalendarContract.EventsColumns.ORIGINAL_ALL_DAY
CalendarContract.EventsColumns.ACCESS_LEVEL
CalendarContract.EventsColumns.AVAILABILITY
CalendarContract.EventsColumns.GUESTS_CAN_MODIFY
CalendarContract.EventsColumns.GUESTS_CAN_INVITE_OTHERS
CalendarContract.EventsColumns.GUESTS_CAN_SEE_GUESTS
CalendarContract.EventsColumns.CUSTOM_APP_PACKAGE
CalendarContract.EventsColumns.CUSTOM_APP_URI
CalendarContract.EventsColumns.UID_2445
CalendarContract.SyncColumns.DIRTY
CalendarContract.SyncColumns.MUTATORS
CalendarContract.SyncColumns._SYNC_ID
CalendarContract.EventsColumns.SYNC_DATA1
CalendarContract.EventsColumns.SYNC_DATA2
CalendarContract.EventsColumns.SYNC_DATA3
CalendarContract.EventsColumns.SYNC_DATA4
CalendarContract.EventsColumns.SYNC_DATA5
CalendarContract.EventsColumns.SYNC_DATA6
CalendarContract.EventsColumns.SYNC_DATA7
CalendarContract.EventsColumns.SYNC_DATA8
CalendarContract.EventsColumns.SYNC_DATA9
CalendarContract.EventsColumns.SYNC_DATA10
Summary
Inherited constants | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Fields | |
---|---|
public
static
final
Uri |
CONTENT_EXCEPTION_URI
The content:// style URI for recurring event exceptions. |
public
static
final
Uri |
CONTENT_URI
The content:// style URL for interacting with events. |
public
static
final
Uri |
ENTERPRISE_CONTENT_URI
The content:// style URL for querying Events table in the managed profile. |
Inherited methods | |||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Fields
CONTENT_EXCEPTION_URI
public static final Uri CONTENT_EXCEPTION_URI
The content:// style URI for recurring event exceptions. Insertions require an
appended event ID. Deletion of exceptions requires both the original event ID and
the exception event ID (see Uri.Builder#appendPath
).
CONTENT_URI
public static final Uri CONTENT_URI
The content:// style URL for interacting with events. Appending an
event id using ContentUris#withAppendedId(Uri, long)
will
specify a single event.
ENTERPRISE_CONTENT_URI
public static final Uri ENTERPRISE_CONTENT_URI
The content:// style URL for querying Events table in the managed profile. Appending an
event id using ContentUris#withAppendedId(Uri, long)
specifies a single event.
The following columns are allowed to be queried via this uri:
BaseColumns._ID
CalendarContract.EventsColumns.CALENDAR_ID
CalendarContract.EventsColumns.TITLE
CalendarContract.EventsColumns.EVENT_LOCATION
CalendarContract.EventsColumns.EVENT_COLOR
CalendarContract.EventsColumns.STATUS
CalendarContract.EventsColumns.DTSTART
CalendarContract.EventsColumns.DTEND
CalendarContract.EventsColumns.EVENT_TIMEZONE
CalendarContract.EventsColumns.EVENT_END_TIMEZONE
CalendarContract.EventsColumns.DURATION
CalendarContract.EventsColumns.ALL_DAY
CalendarContract.EventsColumns.AVAILABILITY
CalendarContract.EventsColumns.RRULE
CalendarContract.EventsColumns.RDATE
CalendarContract.EventsColumns.LAST_DATE
CalendarContract.EventsColumns.EXRULE
CalendarContract.EventsColumns.EXDATE
CalendarContract.EventsColumns.SELF_ATTENDEE_STATUS
CalendarContract.EventsColumns.DISPLAY_COLOR
CalendarContract.CalendarColumns.CALENDAR_COLOR
CalendarContract.CalendarColumns.VISIBLE
CalendarContract.CalendarColumns.CALENDAR_TIME_ZONE
CalendarContract.CalendarColumns.IS_PRIMARY
IllegalArgumentException
is thrown if there exists columns in the
projection of the query to this uri that are not contained in the above list.
This uri returns an empty cursor if the calling user is not a parent profile
of a managed profile, or the managed profile is disabled, or cross-profile calendar is
disabled in Settings, or this uri is queried from a package that is not allowed by
the profile owner of the managed profile via
DevicePolicyManager#setCrossProfileCalendarPackages(ComponentName, Set)
.
Apps can register a ContentObserver
for this URI to listen
to changes.