Added in API level 14

Instances


class Instances : BaseColumns, CalendarContract.CalendarColumns, CalendarContract.EventsColumns
kotlin.Any
   ↳ 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
static String

The beginning time of the instance, in UTC milliseconds.

static String

The ending time of the instance, in UTC milliseconds.

static String

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

static String

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

static String

The _id of the event for this instance.

static String

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

static String

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

Inherited constants
Public methods
static Cursor!
query(cr: ContentResolver!, projection: Array<String!>!, begin: Long, end: Long)

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

static Cursor!
query(cr: ContentResolver!, projection: Array<String!>!, begin: Long, end: Long, searchQuery: String!)

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

Properties
static Uri!

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

static Uri!

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

static Uri!

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

static Uri!

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

static Uri

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

static Uri

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

static Uri

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

static Uri

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

Constants

BEGIN

Added in API level 14
static val BEGIN: String

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

Type: INTEGER (long; millis since epoch)

Value: "begin"

END

Added in API level 14
static val END: String

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

Type: INTEGER (long; millis since epoch)

Value: "end"

END_DAY

Added in API level 14
static val END_DAY: String

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

Type: INTEGER (int)

Value: "endDay"

END_MINUTE

Added in API level 14
static val END_MINUTE: String

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

Type: INTEGER (int)

Value: "endMinute"

EVENT_ID

Added in API level 14
static val EVENT_ID: String

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

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

Value: "event_id"

START_DAY

Added in API level 14
static val START_DAY: String

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

Type: INTEGER (int)

Value: "startDay"

START_MINUTE

Added in API level 14
static val START_MINUTE: String

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

Type: INTEGER (int)

Value: "startMinute"

Public methods

query

Added in API level 14
static fun query(
    cr: ContentResolver!,
    projection: Array<String!>!,
    begin: Long,
    end: Long
): Cursor!

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 Array<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
Return
Cursor! A Cursor containing all instances in the given range

query

Added in API level 14
static fun query(
    cr: ContentResolver!,
    projection: Array<String!>!,
    begin: Long,
    end: Long,
    searchQuery: String!
): Cursor!

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 Array<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.
Return
Cursor! A Cursor of instances matching the search terms in the given time range

Properties

CONTENT_BY_DAY_URI

Added in API level 14
static val CONTENT_BY_DAY_URI: 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
static val CONTENT_SEARCH_BY_DAY_URI: 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
static val CONTENT_SEARCH_URI: 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
static val CONTENT_URI: 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
static val ENTERPRISE_CONTENT_BY_DAY_URI: 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
static val ENTERPRISE_CONTENT_SEARCH_BY_DAY_URI: 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
static val ENTERPRISE_CONTENT_SEARCH_URI: 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
static val ENTERPRISE_CONTENT_URI: 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).