Add Recurring Calendar Event Tutorial

Add Recurring Calendar Event Tutorial

Description

This article explains how to add Recurring event to Calendar using Tizen platform device API's in your applications. The article applies only for systems based on Tizen platform.

Pre-conditions

To use the Calendar API methods, you must declare the necessary features in the config.xml file.

For the below example,Open the config.xml file, choose the "Feature" tab, and add below features to enable them to use in your applications.

  • http://tizen.org/api/calender : Privilege to allow the use of the full functionalities of the Calendar. API access policy is defined by the implementation or deployment.

Add Recurring Event

To perform a calendar-related operation in an application, first you need to retrieve calendar object. CalendarManager.getDefaultCalendar() method is used to retrieve the default system calendar on the device. We can mention the type of the calendar as an event or a task, by using the getDefaultCalendar method’s type parameter.

      
$ var myCalendar = null;
$ myCalendar = tizen.calendar.getDefaultCalendar("EVENT");

The CalendarRecurrenceRule object contains information about the recurrence of an event.

Here we are creating a new recurrence rule which repeats for 3 days.

      
$ var rule = new tizen.CalendarRecurrenceRule("DAILY", {occurrenceCount: 3});

To define the calendar event properties such as description, summary, startDate, and duration, a CalendarEvent object is created by using a constructor.

  
$ var ev = new tizen.CalendarEvent({
    description : "Enter your description",
    summary : "Enter your Summary", 
    startDate : new tizen.TZDate(2012, 10, 14, 14,25),
    duration: new tizen.TimeDuration(1, "HOURS"),
    recurrenceRule: rule
    });

Now you have to add CalendarEvent object to the default calendar by using the Calendar.add method.

 
$ myCalendar.add(ev);