Calendar - Unable to read recurring events

197
December 18, 2017, at 4:05 PM

I am unable to get recurring events from google calandar. Can any one help me with this.

I have also used "Instances" table to get the recurring events but not. Can any one guide me how to fetch data from "Instances" table. It should be a great help for me.

I used following code to read events.

    Uri uri = CalendarContract.Events.CONTENT_URI;
    String[] projection = new String[]{
            CalendarContract.Events._ID,
            CalendarContract.Events.DTSTART,
            CalendarContract.Events.DTEND,
            CalendarContract.Events.ALL_DAY,
            CalendarContract.Events.TITLE,
            CalendarContract.Events.EVENT_COLOR,
            CalendarContract.Events.CALENDAR_ID,
            CalendarContract.Events.DESCRIPTION,
            CalendarContract.Events.ORGANIZER,
            // If status = 2 it is cancelled by organizer
            CalendarContract.Events.STATUS,
            // If self attendee status  = 2 it is declined by user
            CalendarContract.Events.SELF_ATTENDEE_STATUS,
            CalendarContract.Events.RDATE,
            CalendarContract.Events.LAST_DATE
    };
    String[] calendarID;
    for (int i = 0; i < EmailId.size(); i++) {
        calendarID = new String[]{EmailId.get(i)};
       Cursor c = context.getContentResolver().query(uri, projection,
                CalendarContract.Instances.CALENDAR_ID + " = ?", calendarID, CalendarContract.Events.DTSTART);
        if (c.moveToFirst()) {
            do {
                Evnt e = new Evnt();
                e._id = c.getLong(0);
                e.startDate = "";
                e.startDate = getDate(c.getString(1));
                e.startTime = "";
                e.startTime = getTime(c.getString(1));

                e.endDate = "";
                e.endDate = getDate(c.getString(2));
                e.endTime = "";
                e.endTime = getTime(c.getString(2));
                e.all_day = c.getInt(3);
                e.title = c.getString(4);
                e.color = c.getInt(5);
                e.calendar_id = c.getLong(6);
                e.desc = c.getString(7);
                e.organizer = c.getString(8);
                e.nine = c.getString(9);
                e.ten = c.getString(10);
                e.eleven = c.getString(11);
                e.twelve = "";
                e.twelve = getDate(c.getString(12));
                ourEvents.add(e);
            } while (c.moveToNext());
        }
Rent Charter Buses Company
READ ALSO
How to control URL of anything from Firebase database

How to control URL of anything from Firebase database

I have just started Android developmentI am making my college news feed app using Firebase, in which there is a list of items having an image, title and description

236
How to make lombok annotation @NotNull work in IntelliJ?

How to make lombok annotation @NotNull work in IntelliJ?

For some reason lombok @NotNull annotation does not work in my maven project in IntelliJ IDEA

457
How to work with time intervall in java

How to work with time intervall in java

i have this situation : I am trying to do an excercise about the prenotation of a user for a cinemaA user can be only in one film at the moment, (but he can buy another ticket for the next show if he want)

314
How to generate jaxb2 classes on Intellij build?

How to generate jaxb2 classes on Intellij build?

I am trying to generate jaxb2 classes on an Intellij Build

347