php - Download .ics from website to Android calendar -
i have problem .ics files , calendar on smartphone. first, create ics file , download it, use function :
function createeventcalendar($start, $end, $description, $location) { $event = array(); $rand = rand(5, 1000000000); $event['name'] = "event"; $event['data'] = "begin:vcalendar\nversion:2.0\nprodid:-//blabla//blabla//fr\nbegin:vevent\ndtstamp:".date('ymd\this')."\nstatus:confirmed\nuid:".$rand."\ndtstart:".date('ymd\this', strtotime($start))."\ndtend:".date('ymd\this', strtotime($end))."\nsummary:rendez-vous assurance\ndescription:".$description."\nlocation:".$location."\nend:vevent\nend:vcalendar\r\n"; return $event; } public function downloadeventcalendar($event) { $eventname = $event['name'].'.ics'; header("content-type: text/x-vcalendar"); header("content-disposition: attachment; filename=\"".$eventname."\""); echo $event['data']; exit(); }
for exemple dtend
finish 1 hours after dtstart
. problem when download file xperia , click on event event.ics
, choose default account : calendar of device
, event never imported , screen blocked, can see :
did forget add parameter android ? because works ios.
update : here ics generated code
begin:vcalendar version:2.0 prodid:-//blabla//blabla//fr begin:vevent dtstamp:20150804t095037 status:confirmed uid:495370174 dtstart:20150901t120000 dtend:20150901t130000 summary:my summary description:description of event location:my calendar end:vevent end:vcalendar
thanks
there's several problems generated icalendar file. suggest try online validator. if still have issues after that, should share actual generated icalendar, not code generates (especially if it's on 1 line :/)
Comments
Post a Comment