I am trying to create calendar event in my Titanium App for Android Platform. For that I am using below code, It does't give any error also didn't to create any calendar events
var calendars = Ti.Android.Calendar.selectableCalendars;
var names =[];
for (var i = 0; i<calendars.length; i++) {
names.push(calendars[i].name);
}
var calendarDialog = Titanium.UI.createOptionDialog({
title: 'Select a Calendar',
options: names,
cancel:1
});
calendarDialog.addEventListener('click', function(e){
var ci = e.index+1;
var calendar = Ti.Android.Calendar.getCalendarById(ci);
var eventBegins = new Date(2011, 12, 26, 12, 0, 0);
var eventEnds = new Date(2011, 12, 26, 14, 0, 0);
var hasReminder = true;
var details = {
title: 'i m testing',
description: 'message',
begin: eventBegins,
end: eventEnds,
hasAlarm:true,
allDay:true
};
var event = calendar.createEvent(details);
if (hasReminder)
{
var reminderDetails = {
minutes: 10,
method: Ti.Android.Calendar.METHOD_ALERT
};
event.createReminder(reminderDetails);
}
alert('Event was created!');
});
calendarDialog.show();
Anyone help me to solve this issue.. My Titanium SDK version is 1.7.5, I have tried this in Android 2.3 Phone