Android get .ics file for calendar events -
i able fetch calendar events android device using calendar events cursor. want extract .ics file.
is possible extract .ics? if not can generate .ics file cursor?
i expecting .ics file looks below :
begin:vcalendar version:1.0 begin:vevent categories:meeting status:tentative dtstart:19960401t033000z dtend:19960401t043000z summary:your proposal review description:steve , john review newest proposal material class:private end:vevent end:vcalendar
edit : further want group multiple calendar events single .ics file
you have download biweekly.jar first http://sourceforge.net/projects/biweekly
ical = new icalendar();// creating ical object vevent event = new vevent(); summary summary = event.setsummary("meeting"); attendee attendee1=event.addattendee(email); attendee attendee2=event.addattendee(myemail); location location=event.setlocation(venue); summary.setlanguage("en-us"); start = dt; event.setdescription(comments); event.setdatestart(new datestart(start, false)); try { if(chosenfile!=null) event.addattachment(new attachment("", chosenfile));// adding attachment } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } ical.addevent(event); string filepath = environment.getexternalstoragedirectory() + "/meetings.ics"; file = new file(filepath); file root = new file(environment.getexternalstoragedirectory(), "notes"); if (!root.exists()) { root.mkdirs(); } file file = new file(root,"meetings.ics"); biweekly.write(ical).go(file); if(!isconnected()) showdialog(); else { // taking user device calender enable user store meeting in local calendar if wishes intent calintent = new intent(intent.action_insert); calintent.settype("vnd.android.cursor.item/event"); calintent.putextra(events.title, "meeting"); calintent.putextra(events.event_location, venue); calintent.putextra(events.description, comments); calintent.putextra(calendarcontract.attendees.attendee_name, name); calintent.putextra(calendarcontract.attendees.attendee_email, email); calintent.putextra(calendarcontract.extra_event_begin_time, start.gettime()); calintent.putextra(calendarcontract.extra_event_end_time, start.gettime()+3600000); startactivityforresult(calintent, 1); }
Comments
Post a Comment