I have the following code for adding event to calendar.
The problem is that I don\'t know how to retrieve the default calendar id.
l
Some latest versions have issue, there is different visible calendar list so below is the code to select PRIMARY calendar and in older devices this query return 0 record, so used second one if 1st one return 0 records.
Cursor calCursor = mContext.getContentResolver().query(CalendarContract.Calendars.CONTENT_URI, projection, CalendarContract.Calendars.VISIBLE + " = 1 AND " + CalendarContract.Calendars.IS_PRIMARY + "=1", null, CalendarContract.Calendars._ID + " ASC");
if(calCursor.getCount() <= 0){
calCursor = mContext.getContentResolver().query(CalendarContract.Calendars.CONTENT_URI, projection, CalendarContract.Calendars.VISIBLE + " = 1", null, CalendarContract.Calendars._ID + " ASC");
}