Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Google Calendar "Unable to launch event"

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.

Here is the file

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

like image 789
Vishal Vyas Avatar asked Oct 31 '22 07:10

Vishal Vyas


2 Answers

I had a similar problem with .ics files created by my web application. Desktop gmail reacted to them just fine, but on android opening the attachment resulted in "Unable to launch event". ICS files generated by Google Calendar for its invitation mails worked fine, so I did some binary search and figured out the problem: my .ics files were missing the DTSTAMP property. The property is mandatory, so the mobile app was wrong to complain, I just wish the error message had been more informative.

The lesson is: the web application may be more loose than the mobile one, so don't assume you have a proper implementation of the standard just because it works fine in one or the other.

like image 129
Mitten.O Avatar answered Nov 11 '22 10:11

Mitten.O


Currently - and it's 27 April 2016 - the provided file opens fine on my Google Calendar for Android v.5.4-1198... But I had a similar issue and it turned out that Google Calendar failes to import .ics files that are UTF-8 with BOM. Now I send them from the server as UTF-8 without BOM and everything's fine.

like image 42
Usurer Avatar answered Nov 11 '22 12:11

Usurer