how to add event in Calendar?

2019-09-05 05:25发布

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).

3条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-09-05 06:08

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

查看更多
该账号已被封号
3楼-- · 2019-09-05 06:17

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

查看更多
可以哭但决不认输i
4楼-- · 2019-09-05 06:20

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

查看更多
登录 后发表回答