Android Google日历“无法启动活动"; [英] Android Google Calendar "Unable to launch event"

查看:158
本文介绍了Android Google日历“无法启动活动";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

案例1 我已经在Amazon AWS上托管了一个日历事件iCal .ics 文件,并且该URL的HTTP URL已集成到我的Android应用程序中.

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.

此处是文件

当用户单击URL时,将显示一个具有以下选项的意图选择器:

When the user clicks on URL, an intent chooser is displayed with following options:

  • 日历应用
  • 浏览器下载文件

选择Google日历后,出现错误消息无法启动事件"

When I select Google Calendar, it gives me an error that says "Unable to launch event"

当我选择Chrome时,文件将被下载,并且当用户单击下载的文件时,会出现相同的错误无法启动事件"

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"

以下是使用桌面chrome http客户端邮递员下载文件时的响应标头

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

案例2 为了进行实验,我在本地Apache服务器上编写了一个简单的PHP脚本,以下载相同的文件,而不是直接从HTTP URL访问文件

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代码

<?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;
    }
?>

文件已成功下载,然后

  • 单击下载的文件
  • 从意图选择器中选择了Google日历
  • 活动已成功添加到Google日历中

以下是使用PHP脚本时的响应标头

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

请问有人可以帮助您了解为什么事件未保存或无法用于案例1吗?

Can any one please help to understand why the event is not saved or working for case 1??

先谢谢了.请帮忙.

修改

Android设备:Nexus 6(6.0.1)

Android Device: Nexus 6 (6.0.1)

Google日历应用:5.3.6-115544951版本

Google Calendar App: 5.3.6-115544951-release

推荐答案

我的Web应用程序创建的.ics文件存在类似的问题.桌面gmail对它们的反应很好,但是在android上打开附件后导致无法启动事件".由Google日历为其邀请邮件生成的ICS文件工作正常,因此我进行了一些二进制搜索并找出了问题所在:我的.ics文件缺少 DTSTAMP 属性.该属性是强制性的,因此该移动应用程序要抱怨是错误的,我只是希望该错误消息能提供更多信息.

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.

教训是:Web应用程序可能比移动应用程序更松散,所以不要仅仅因为它可以在一个或另一个应用程序中正常工作就假定您已经对该标准进行了适当的实现.

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.

这篇关于Android Google日历“无法启动活动";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆