Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically add event in iPhone/Android Calendar with PhoneGap/jQuery Mobile?

Tags:

How can I create a calendar event from a JavaScript / jQuery Mobile / PhoneGap app in iOS/Android?

Are there any, e.g., PhoneGap plugins? Didn't see any in the official repository.

  • For iOS, the Event Kit framework (iOS 4.0+) seems to be able to add an event.
like image 671
Michael Schmidt Avatar asked Oct 07 '11 09:10

Michael Schmidt


2 Answers

Per the comments below, it is now possible to create an iCal file for iOS and a vcs file for Android. It will require browser/device sniffing, or give the user the choice, but it should at least be possible.

like image 96
SlowTree Avatar answered Oct 20 '22 09:10

SlowTree


I realize it's old question but there is plugin for this now. It has its cons, but works. At the moment of writing it supports the following functionality:

  • iOS supports: create (silently), update (silently) and delete (silently) event
  • Android >= 4: create (interactively and silently), update (not supported), delete (silently) event
  • Android < 4: create (interactively), update (not supported), delete (not supported) event

Here follows code example:

  var startDate = new Date(2014,2,15,18,30,0,0,0);   var endDate = new Date(2014,2,15,19,30,0,0,0);   var title = "My nice event";   var newTitle = "My new nice event";   var location = "Home";   var notes = "Some notes about this event.";   var success = function(message) {       alert("Success: " + JSON.stringify(message));    };   var error = function(message) {       alert("Error: " + message);    };    window.plugins.calendar.createEvent(title,location,notes,startDate,endDate,success,error);    window.plugins.calendar.modifyEvent(title,location,notes,startDate,endDate,newTitle,location,notes,startDate,endDate,success,error);    window.plugins.calendar.deleteEvent(newTitle,location,notes,startDate,endDate,success,error); 
like image 27
Darius Kucinskas Avatar answered Oct 20 '22 07:10

Darius Kucinskas