Question
I am able to set an event in my calender. My code is
var ev = new tizen.CalendarEvent
({
description : document.getElementById('des').value,
summary : document.getElementById('summ').value,
startDate : new tizen.TZDate(yy, mm, dd, h, m),
duration : new tizen.TimeDuration(dur1, "HOURS"),
location : document.getElementById('loc').value,
});
How could I set a calendarAlarm event to this? i.e. I want to enable the alarm to the event. Please give code if anyone knows.
Thanks in advance.
Solution
Finally i got the answer
calendar = tizen.calendar.getDefaultCalendar("EVENT");
var ev = new tizen.CalendarEvent({
description : document.getElementById('description1').value,
summary : document.getElementById('Summary1').value,
startDate : new tizen.TZDate(yy, mm, dd, h, m),
duration : new tizen.TimeDuration(dur1, "HOURS"),
location : document.getElementById('Location1').value,
var alarm = new tizen.CalendarAlarm(new tizen.TimeDuration(1, "MINS"), "SOUND");
ev.alarms = [alarm];
calendar.add(ev);
OTHER TIPS
This code I tested on the Tizen phone and it works:
var mycalendar;
try{
mycalendar = tizen.calendar.getDefaultCalendar("EVENT");
var calendarItem = new tizen.CalendarEvent();
calendarItem.description = "Description";
calendarItem.summary = "Summary";
calendarItem.location = "StackOverflow";
calendarItem.startDate = new tizen.TZDate(2012, 8, 7, hour, minute);
calendarItem.duration = new tizen.TimeDuration(duration, "MINS");
mycalendar.add(calendarItem);
}
catch(add_exception){
alert("Exceptie adauga : " + add_exception.message);
}
In your answer the code has errors you didn't closed CalendarEvent({
's bracket and parenthesis and there is a comma standing stray at the end of location
line.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow