I\'m trying to use Android\'s new calendar API to read all of today\'s calendar events. I\'m have trouble finding the right selection on the database query to return all of
To get all events today, including recurring events, you need to use the Instances table, i.e.
Uri.Builder eventsUriBuilder = CalendarContract.Instances.CONTENT_URI
.buildUpon();
ContentUris.appendId(eventsUriBuilder, timeNow);
ContentUris.appendId(eventsUriBuilder, endOfToday);
Uri eventsUri = eventsUriBuilder.build();
Cursor cursor = null;
cursor = mContext.getContentResolver().query(eventsUri, columns, null, null, CalendarContract.Instances.DTSTART + " ASC");
Note that you must append the time constraints to the events uri, you cannot sort any other way.
In order to include all day events as well, just expand the the search to 11:59PM the previous night and 12:00AM tonight.