2012-07-17 68 views
4

我可以在我的日历中设置一个事件。我的代码是如何在tizen中设置日历闹铃

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, 
    }); 

我怎么能设置一个calendarAlarm事件呢?即我想启用事件警报。如果有人知道,请提供代码。

在此先感谢。

回答

5

最后我得到的答案

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); 
0

这段代码我在Tizen phone测试,它的工作原理:

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); 
    } 

在你的答案代码中有你没有关闭CalendarEvent({的错误括号和括号并且在location行末尾有一个逗号流浪。