php - Open automatically .ics on Android -
on website have button, , when click on button, download file called "event.ics". on iphone, when file downloaded, automatically read , can choose calendar, on android , windows phone, need click on file downloaded or go in folder "download" execute .ics
. there way read/execute .ics
on android , wp automatically ?
here can see code download calendar file :
public function createeventcalendar($start, $end, $description, $location) { $event = array(); $rand = rand(5, 1000000000); $event['name'] = "event"; $event['data'] = "begin:vcalendar\r\nversion:2.0\r\nprodid:-//test//test//en\r\nbegin:vevent\r\ndtstamp:".date('ymd\this')."\r\nstatus:confirmed\r\nuid:".$rand."\r\ndtstart:".date('ymd\this', strtotime($start))."\r\ndtend:".date('ymd\this', strtotime($end))."\r\nsummary:blablabla\r\ndescription:".$description."\r\nlocation:".$location."\r\nend:vevent\r\nend:vcalendar"; return $event; } public function downloadeventcalendar($event) { $eventname = $event['name'].'.ics'; header("content-type: text/calendar"); header("content-disposition: attachment; filename=\"".$eventname."\""); echo $event['data']; exit(); }
thanks
Comments
Post a Comment