Search code examples
androidcordovacalendarrecurring-events

Add recurring event for 2 years


I want to add a recurring event in the calendar programatically., i.e directly without using intent. I user the following ::

ContentResolver cr = cordova.getActivity().getContentResolver();
      ContentValues values = new ContentValues();

      values.put(Events.DTSTART, calendarStart.getTimeInMillis());
      values.put(Events.DTEND, calendarEnd.getTimeInMillis());
      values.put(Events.TITLE, title);
      values.put(Events.CALENDAR_ID, 1);
      values.put("rrule", "FREQ=DAILY"); //For recurring event
      values.put(Events.EVENT_TIMEZONE, TimeZone.getDefault().getID());

      Uri uri = cr.insert(eventsUri, values);

The event is only added for 2 weeks . I want it to be added for atleast 2 years or more.., can be forever also. I have used the Combinations UNTIL also,, but nothing works. Wat should I update the code with.. Any help.. Thanks


Solution

  • try this, add

    values.put(Events.DURATION, "P0600S");
    

    Remove

    values.put(Events.DTEND, calendarEnd.getTimeInMillis());