Case 1 I have hosted a calendar event iCal .ics file on Amazon AWS and the HTTP URL to the same is integrated within my Android app.
When the user clicks on URL, an intent chooser is displayed with following options:
- Calendar apps
- Browsers to download file
When I select Google Calendar, it gives me an error that says "Unable to launch event"
When I select Chrome, the file get's downloaded and when the user clicks on downloaded file it gives same error "Unable to launch event"
Following are the response headers when the file is downloaded using a desktop chrome http client Postman
Accept-Ranges → bytes
Content-Length → 959
Content-Type → application/octet-stream
Date → Thu, 10 Mar 2016 13:45:10 GMT
ETag → "5d48719213395a28e09e8adf01f6ce83"
Last-Modified → Wed, 09 Mar 2016 15:24:22 GMT
Server → AmazonS3
x-amz-id-2 → XXXXXXXXXXXXXXXXXXXXXXXXX
x-amz-request-id → XXXXXXXXXXXXXXXXXXX
Case 2 To experiment, I wrote a simple PHP script on my local Apache server to download the same file instead of directly accessing file from HTTP URL
PHP Code
<?php
$file = $_GET['file'];
if (file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
exit;
}
?>
The file got downloaded successfully and then
- Downloaded file is clicked
- Google calendar is selected from intent chooser
- Event is added successfully in google calendar
Following are the response headers when using PHP script
Cache-Control → must-revalidate, post-check=0, pre-check=0
Connection → Keep-Alive
Content-Description → File Transfer
Content-Disposition → attachment; filename=World_Television_Premiere_of_House_Of_Cards_March_1213_5pm_on_Zee_Cafe.ics
Content-Length → 959
Content-Transfer-Encoding → binary
Content-Type → application/octet-stream
Date → Thu, 10 Mar 2016 07:27:15 GMT
Expires → 0
Keep-Alive → timeout=5, max=100
Pragma → public
Server → Apache/2.4.7 (Ubuntu)
X-Powered-By → PHP/5.5.9-1ubuntu4.14
Can any one please help to understand why the event is not saved or working for case 1??
Thanks in advance. Please help.
Edit
Android Device: Nexus 6 (6.0.1)
Google Calendar App: 5.3.6-115544951-release