Case 1我主持了 iCal 日历活动.icsAmazon AWS 上的文件及其 HTTP URL 集成在我的 Android 应用程序中。
这是文件 https://s3-ap-southeast-1.amazonaws.com/endcards/calendar/World_Television_Premiere_of_House_Of_Cards_March_1213_5pm_on_Zee_Cafe.ics
当用户单击 URL 时,将显示一个意图选择器,其中包含以下选项:
当我选择 Google 日历时,出现错误“无法启动活动”
当我选择 Chrome 时,文件会被下载,当用户单击下载的文件时,会出现相同的错误“无法启动事件”
以下是使用桌面 Chrome http 客户端 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为了进行实验,我在本地 Apache 服务器上编写了一个简单的 PHP 脚本来下载相同的文件,而不是直接从 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;
}
?>
文件已成功下载,然后
- 单击下载的文件
- Google 日历是从意图选择器中选择的
- 活动已成功添加到 Google 日历中
以下是使用 PHP 脚本时的响应标头
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 吗?
提前致谢。
请帮忙。
Edit
Android 设备:Nexus 6 (6.0.1)
谷歌日历应用程序:5.3.6-115544951-release