Relationship between events from CalendarContract.Events and recurring events in CalendarContract.Instances android

19 Views Asked by At

After query event details from CalendarContract.EVENTS.CONTENT_URI using content URI value,

Is it possible to use this event details to query all recurring instances fromCalendarContract.Instances.

contentResolver.query(contentUri.toUri(), null, "", null, "")

Event details such as _ID, RRULE, TITLE, DTSTART, DTEND, DTLAST example Test Event 1

val builder = CalendarContract.Instances.CONTENT_URI.buildUpon()
ContentUris.appendId(builder, startMillis)
ContentUris.appendId(builder, lastDateInMillis)

Example: Test Event 1, Test Event 2, Test Event 3

This will give list of all events instances between startMillis and lastDateInMillis.

How do we identify Test Event 1 from EventInstances with some unique value from Event?

Using TITLE or any of the above value is not correct way.

There must be any unique id that like PrimaryKey from event and ForeignKey from eventInstances

1

There are 1 best solutions below

0
Yash On

Resolved:

CalendarContract.Events.CONTENT_URI has CalendarContract.Events._ID

CalendarContract.Instances.CONTENT_URI has CalendarContract.Instances.EVENT_ID

Using the above ID and EVENT_ID, relationships can be made.