how to add event in Calendar?

[亡魂溺海] 提交于 2019-12-12 02:29:39

问题


Question is : how to add any event in calender?

i want to make a application, in which we can store any event in Calendar. with date and time and it have 3 option Daily, Weekly, and MOnthly, it remembered me whose option is selected.

NOte : (iphone or android both) (Titanium).


回答1:


this This is for Android and for iphone we can use ti.Com.calendar module this is provide by third party. GitHub this




回答2:


Basically this can be done in android using intents, please find the full documentation here




回答3:


ok let's put an example :

 var cal = Ti.Calendar.defaultCalendar;
 var start_date = new Date(year,month,day,hour,minute,second,millisecond);
 var end_date = new Date(year,month,day,hour,minute,second,millisecond);

 var event = cal.createEvent({
    title: 'Your Title',
    begin: start_date,
    end: end_date,
    availability: Ti.Calendar.AVAILABILITY_FREE,
    allDay: true
});

 var mil = 60*1000;

 //adding alert to your event , this alert will be before the start _date with 1 minutes
 var alert1 = event.createAlert({
    relativeOffset: mil
});

 event.alerts = [alert1];
 event.save(Ti.Calendar.SPAN_FUTUREEVENTS);

hope this will help you here is the documentation link : http://docs.appcelerator.com/titanium/3.0/#!/api/Titanium.Calendar.Event



来源:https://stackoverflow.com/questions/9467468/how-to-add-event-in-calendar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!