I have tried to get attendance name and emails using belwo code, but still not working.
Cursor cur = contentResolver.query(CalendarContract.Attendees.CONTENT_URI, new String[]{Attendees.ATTENDEE_STATUS, Attendees.ATTENDEE_RELATIONSHIP, Attendees.ATTENDEE_EMAIL}, Attendees.EVENT_ID +"= "+Long.parseLong("10"), null, null);
if(cur!=null){
SapGenConstants.showLog("cur size: "+cur.getCount());
while(cur.moveToNext()){
attendee_status = cur.getString(cur.getColumnIndex(Attendees.ATTENDEE_STATUS));
attendee_name = cur.getString(cur.getColumnIndex(Attendees.ATTENDEE_RELATIONSHIP));
attendee_Email = cur.getString(cur.getColumnIndex(Attendees.ATTENDEE_EMAIL));
SapGenConstants.showLog("attendee_status 2: "+attendee_status);
SapGenConstants.showLog("attendee_name 2: "+attendee_name);
SapGenConstants.showLog("attendee_Email 2: "+attendee_Email);
}
cur.close();
}
i just ran into the same issue - and it was because of a mixup between the instance id and the event id, two distinct elements.
The important thing is that the attendees table is based on the EVENT id - and not the instance id - so it may explain your problem. Where do you get the hardcoded "10" from ?
If it's an instance id, then extract the EVENT id of the event series it belongs to, and pass that on to the ATTENDEES table. See if that helps.
This is how you do it:
Since these queries are IO operations, it is advised to call them on a non-UI thread; my tip would be to go with RxJava.
If you don't want to work with cursors and queries (and a lot of boilerplate code), take a look at the CalendarWrapper library. It takes care of mapping objects and database rows to and from, CRUD operations can be performed with object methods. For example, this is how you'd query all attendees for an event ID: