CalendarContract.Instances


public static final class CalendarContract.Instances
extends Object implements BaseColumns, CalendarContract.CalendarColumns, CalendarContract.EventsColumns

java.lang.Object
   ↳ android.provider.CalendarContract.Instances


Fields and helpers for interacting with Instances. An instance is a single occurrence of an event including time zone specific start and end days and minutes. The instances table is not writable and only provides a way to query event occurrences.

Summary

Constants

String BEGIN

The beginning time of the instance, in UTC milliseconds.

String END

The ending time of the instance, in UTC milliseconds.

String END_DAY

The Julian end day of the instance, relative to the local time zone.

String END_MINUTE

The end minute of the instance measured from midnight in the local time zone.

String EVENT_ID

The _id of the event for this instance.

String START_DAY

The Julian start day of the instance, relative to the local time zone.

String START_MINUTE

The start minute of the instance measured from midnight in the local time zone.

Inherited constants

String _COUNT

The count of rows in a directory.

String _ID

The unique ID for a row.

String ALLOWED_ATTENDEE_TYPES

A comma separated list of attendee types supported for this calendar in the format "#,#,#".

String ALLOWED_AVAILABILITY

A comma separated list of availability types supported for this calendar in the format "#,#,#".

String ALLOWED_REMINDERS

A comma separated list of reminder methods supported for this calendar in the format "#,#,#".

String CALENDAR_ACCESS_LEVEL

The level of access that the user has for the calendar

Type: INTEGER (one of the values below)

String CALENDAR_COLOR

The color of the calendar.

String CALENDAR_COLOR_KEY

A key for looking up a color from the Colors table.

String CALENDAR_DISPLAY_NAME

The display name of the calendar.

String CALENDAR_TIME_ZONE

The time zone the calendar is associated with.

int CAL_ACCESS_CONTRIBUTOR

Full access to modify the calendar, but not the access control settings

int CAL_ACCESS_EDITOR

Full access to modify the calendar, but not the access control settings

int CAL_ACCESS_FREEBUSY

Can only see free/busy information about the calendar

int CAL_ACCESS_NONE

Cannot access the calendar

int CAL_ACCESS_OVERRIDE

not used

int CAL_ACCESS_OWNER

Full access to the calendar

int CAL_ACCESS_READ

Can read all event details

int CAL_ACCESS_RESPOND

Can reply yes/no/maybe to an event

int CAL_ACCESS_ROOT

Domain admin

String CAN_MODIFY_TIME_ZONE

Can the organizer modify the time zone of the event? Column name.

String CAN_ORGANIZER_RESPOND

Can the organizer respond to the event? If no, the status of the organizer should not be shown by the UI.

String IS_PRIMARY

Is this the primary calendar for this account.

String MAX_REMINDERS

The maximum number of reminders allowed for an event.

String OWNER_ACCOUNT

The owner account for this calendar, based on the calendar feed.

String SYNC_EVENTS

Is this calendar synced and are its events stored on the device? 0 - Do not sync this calendar or store events for this calendar.

String VISIBLE

Is the calendar selected to be displayed? 0 - do not show events associated with this calendar.

int ACCESS_CONFIDENTIAL

Confidential is not used by the app.

int ACCESS_DEFAULT

Default access is controlled by the server and will be treated as public on the device.

String ACCESS_LEVEL

Defines how the event shows up for others when the calendar is shared.

int ACCESS_PRIVATE

Private shares the event as a free/busy slot with no details.

int ACCESS_PUBLIC

Public makes the contents visible to anyone with access to the calendar.

String ALL_DAY

Is the event all day (time zone independent).

String AVAILABILITY

If this event counts as busy time or is still free time that can be scheduled over.

int AVAILABILITY_BUSY

Indicates that this event takes up time and will conflict with other events.

int AVAILABILITY_FREE

Indicates that this event is free time and will not conflict with other events.

int AVAILABILITY_TENTATIVE

Indicates that the owner's availability may change, but should be considered busy time that will conflict.

String CALENDAR_ID

The Calendars._ID of the calendar the event belongs to.

String CAN_INVITE_OTHERS

Whether the user can invite others to the event.

String CUSTOM_APP_PACKAGE

The package name of the custom app that can provide a richer experience for the event.

String CUSTOM_APP_URI

The URI used by the custom app for the event.

String DESCRIPTION

The description of the event.

String DISPLAY_COLOR

This will be EVENT_COLOR if it is not null; otherwise, this will be Calendars.CALENDAR_COLOR.

String DTEND

The time the event ends in UTC millis since epoch.

String DTSTART

The time the event starts in UTC millis since epoch.

String DURATION

The duration of the event in RFC2445 format.

String EVENT_COLOR

A secondary color for the individual event.

String EVENT_COLOR_KEY

A secondary color key for the individual event.

String EVENT_END_TIMEZONE

The timezone for the end time of the event.

String EVENT_LOCATION

Where the event takes place.

String EVENT_TIMEZONE

The timezone for the event.

String EXDATE

The recurrence exception dates for the event.

String EXRULE

The recurrence exception rule for the event.

String GUESTS_CAN_INVITE_OTHERS

Whether guests can invite other guests.

String GUESTS_CAN_MODIFY

Whether guests can modify the event.

String GUESTS_CAN_SEE_GUESTS

Whether guests can see the list of attendees.

String HAS_ALARM

Whether the event has an alarm or not.

String HAS_ATTENDEE_DATA

Whether the event has attendee information.

String HAS_EXTENDED_PROPERTIES

Whether the event has extended properties or not.

String IS_ORGANIZER

Are we the organizer of this event.

String LAST_DATE

The last date this event repeats on, or NULL if it never ends.

String LAST_SYNCED

Used to indicate that a row is not a real event but an original copy of a locally modified event.

String ORGANIZER

Email of the organizer (owner) of the event.

String ORIGINAL_ALL_DAY

The allDay status (true or false) of the original recurring event for which this event is an exception.

String ORIGINAL_ID

The Events._ID of the original recurring event for which this event is an exception.

String ORIGINAL_INSTANCE_TIME

The original instance time of the recurring event for which this event is an exception.

String ORIGINAL_SYNC_ID

The _sync_id of the original recurring event for which this event is an exception.

String RDATE

The recurrence dates for the event.

String RRULE

The recurrence rule for the event.

String SELF_ATTENDEE_STATUS

This is a copy of the attendee status for the owner of this event.

String STATUS

The event status.

int STATUS_CANCELED

int STATUS_CONFIRMED

int STATUS_TENTATIVE

String SYNC_DATA1

This column is available for use by sync adapters.

String SYNC_DATA10

This column is available for use by sync adapters.

String SYNC_DATA2

This column is available for use by sync adapters.

String SYNC_DATA3

This column is available for use by sync adapters.

String SYNC_DATA4

This column is available for use by sync adapters.

String SYNC_DATA5

This column is available for use by sync adapters.

String SYNC_DATA6

This column is available for use by sync adapters.

String SYNC_DATA7

This column is available for use by sync adapters.

String SYNC_DATA8

This column is available for use by sync adapters.

String SYNC_DATA9

This column is available for use by sync adapters.

String TITLE

The title of the event.

String UID_2445

The UID for events added from the RFC 2445 iCalendar format.

Fields

public static final Uri CONTENT_BY_DAY_URI

The content:// style URL for querying an instance range by Julian Day.

public static final Uri CONTENT_SEARCH_BY_DAY_URI

The content:// style URL for querying an instance range with a search term.

public static final Uri CONTENT_SEARCH_URI

The content:// style URL for querying an instance range with a search term.

public static final Uri CONTENT_URI

The content:// style URL for querying an instance range.

public static final Uri ENTERPRISE_CONTENT_BY_DAY_URI

The content:// style URL for querying an instance range by Julian Day in the managed profile.

public static final Uri ENTERPRISE_CONTENT_SEARCH_BY_DAY_URI

The content:// style URL for querying an instance range with a search term in the managed profile.

public static final Uri ENTERPRISE_CONTENT_SEARCH_URI

The content:// style URL for querying an instance range with a search term in the managed profile.

public static final Uri ENTERPRISE_CONTENT_URI

The content:// style URL for querying an instance range in the managed profile.

Public methods

static Cursor query(ContentResolver cr, String[] projection, long begin, long end)

Performs a query to return all visible instances in the given range.

static Cursor query(ContentResolver cr, String[] projection, long begin, long end, String searchQuery)

Performs a query to return all visible instances in the given range that match the given query.

Inherited methods

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

Constants

BEGIN

Added in API level 14
public static final String BEGIN

The beginning time of the instance, in UTC milliseconds. Column name.

Type: INTEGER (long; millis since epoch)

Constant Value: "begin"

END

Added in API level 14
public static final String END

The ending time of the instance, in UTC milliseconds. Column name.

Type: INTEGER (long; millis since epoch)

Constant Value: "end"

END_DAY

Added in API level 14
public static final String END_DAY

The Julian end day of the instance, relative to the local time zone. Column name.

Type: INTEGER (int)

Constant Value: "endDay"

END_MINUTE

Added in API level 14
public static final String END_MINUTE

The end minute of the instance measured from midnight in the local time zone. Column name.

Type: INTEGER (int)

Constant Value: "endMinute"

EVENT_ID

Added in API level 14
public static final String EVENT_ID

The _id of the event for this instance. Column name.

Type: INTEGER (long, foreign key to the Events table)

Constant Value: "event_id"

START_DAY

Added in API level 14
public static final String START_DAY

The Julian start day of the instance, relative to the local time zone. Column name.

Type: INTEGER (int)

Constant Value: "startDay"

START_MINUTE

Added in API level 14
public static final String START_MINUTE

The start minute of the instance measured from midnight in the local time zone. Column name.

Type: INTEGER (int)

Constant Value: "startMinute"

Fields

CONTENT_BY_DAY_URI

Added in API level 14
public static final Uri CONTENT_BY_DAY_URI

The content:// style URL for querying an instance range by Julian Day. The start and end day should be added as path segments if this is used directly.

CONTENT_SEARCH_BY_DAY_URI

Added in API level 14
public static final Uri CONTENT_SEARCH_BY_DAY_URI

The content:// style URL for querying an instance range with a search term. The start day, end day, and search string should be appended as path segments if this is used directly.

CONTENT_SEARCH_URI

Added in API level 14
public static final Uri CONTENT_SEARCH_URI

The content:// style URL for querying an instance range with a search term. The begin, end, and search string should be appended as path segments if this is used directly.

CONTENT_URI

Added in API level 14
public static final Uri CONTENT_URI

The content:// style URL for querying an instance range. The begin and end of the range to query should be added as path segments if this is used directly.

ENTERPRISE_CONTENT_BY_DAY_URI

Added in API level 29
public static final Uri ENTERPRISE_CONTENT_BY_DAY_URI

The content:// style URL for querying an instance range by Julian Day in the managed profile. It supports similar semantics as CONTENT_BY_DAY_URI and performs similar checks as ENTERPRISE_CONTENT_URI.

ENTERPRISE_CONTENT_SEARCH_BY_DAY_URI

Added in API level 29
public static final Uri ENTERPRISE_CONTENT_SEARCH_BY_DAY_URI

The content:// style URL for querying an instance range with a search term in the managed profile. It supports similar semantics as CONTENT_SEARCH_BY_DAY_URI and performs similar checks as ENTERPRISE_CONTENT_URI.

ENTERPRISE_CONTENT_SEARCH_URI

Added in API level 29
public static final Uri ENTERPRISE_CONTENT_SEARCH_URI

The content:// style URL for querying an instance range with a search term in the managed profile. It supports similar semantics as CONTENT_SEARCH_URI and performs similar checks as ENTERPRISE_CONTENT_URI.

ENTERPRISE_CONTENT_URI

Added in API level 29
public static final Uri ENTERPRISE_CONTENT_URI

The content:// style URL for querying an instance range in the managed profile. It supports similar semantics as CONTENT_URI.

The following columns plus the columns that are allowed by Events.ENTERPRISE_CONTENT_URI are allowed to be queried via this uri:

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).

Public methods

query

Added in API level 14
public static Cursor query (ContentResolver cr, 
                String[] projection, 
                long begin, 
                long end)

Performs a query to return all visible instances in the given range. This is a blocking function and should not be done on the UI thread. This will cause an expansion of recurring events to fill this time range if they are not already expanded and will slow down for larger time ranges with many recurring events.

Parameters
cr ContentResolver: The ContentResolver to use for the query

projection String: The columns to return

begin long: The start of the time range to query in UTC millis since epoch

end long: The end of the time range to query in UTC millis since epoch

Returns
Cursor A Cursor containing all instances in the given range

query

Added in API level 14
public static Cursor query (ContentResolver cr, 
                String[] projection, 
                long begin, 
                long end, 
                String searchQuery)

Performs a query to return all visible instances in the given range that match the given query. This is a blocking function and should not be done on the UI thread. This will cause an expansion of recurring events to fill this time range if they are not already expanded and will slow down for larger time ranges with many recurring events.

Parameters
cr ContentResolver: The ContentResolver to use for the query

projection String: The columns to return

begin long: The start of the time range to query in UTC millis since epoch

end long: The end of the time range to query in UTC millis since epoch

searchQuery String: A string of space separated search terms. Segments enclosed by double quotes will be treated as a single term.

Returns
Cursor A Cursor of instances matching the search terms in the given time range