Hello,
I'm using Titanium Studio, build: 3.2.1, and my operating system is Windows 8. I have an android alloy mobile application project. I need to set a calendar event on the calender of the device I tried the example in the appcelerator documentation it doesn't give me an error but it don't set an event in the calendar.
Here is my code:
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(2014, 6, 11, 10, 50, 0); var eventEnds = new Date(2014, 6, 11, 11, 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!....'); } alert('Event was created!'); }); calendarDialog.show();my console shows this:
[INFO] : App successfully installed [INFO] : Starting app: com.calendar/.CalendartestActivity [INFO] : Application pid: 13069 [INFO] : Project built successfully in 1m 14s 959ms -- Start application log ----------------------------------------------------- [INFO] : TiApplication: (main) [0,0] checkpoint, app created. [INFO] : TiApplication: (main) [357,430] Titanium Javascript runtime: v8 [INFO] : TiRootActivity: (main) [0,0] checkpoint, on root activity create, savedInstanceState: null [WARN] : V8Object: Runtime disposed, cannot set property 'userAgent' [INFO] : TiRootActivity: (main) [0,0] checkpoint, on root activity resume. activity = com.calendar.CalendartestActivity@41868218 [INFO] : I/Adreno200-EGL: <qeglDrvAPI_eglInitialize:265>: EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_JB_2.5.04.02.02.040.400_msm8960_JB_2.5_CL3744273_release_AU (CL3744273) [INFO] : I/Adreno200-EGL: Build Date: 06/30/13 Sun [INFO] : I/Adreno200-EGL: Local Branch: [INFO] : I/Adreno200-EGL: Remote Branch: quic/jb_2.5 [INFO] : I/Adreno200-EGL: Local Patches: NONE [INFO] : I/Adreno200-EGL: Reconstruct Branch: AU_LINUX_ANDROID_JB_2.5.04.02.02.040.400 + NOTHING [INFO] : TiRootActivity: (main) [0,0] checkpoint, on root activity resume. activity = com.calendar.CalendartestActivity@41868218 [INFO] : ALERT: (KrollRuntimeThread) [1666,1666] Event was created!.... [INFO] : ALERT: (KrollRuntimeThread) [1,1667] Event was created! [INFO] : TiAnalyticsSvc: (Thread-40982) [40127,41794] Analytics Service Started [INFO] : TiAnalyticsSvc: (Thread-40982) [2073,43867] Stopping Analytics Service