【问题标题】:How do I publish calendar events from browser to calendar app on Android?如何将日历事件从浏览器发布到 Android 上的日历应用程序?
【发布时间】:2013-10-15 23:57:57
【问题描述】:

我有一个发出日历事件的 Web 服务:http://calevent.herokuapp.com。在 iOS 上,该 URL 将打开一个日历弹出窗口,其中包含事件详细信息和一个允许用户添加到她的日历的按钮。在我的主要 Android 设备上,运行 Android 4.1 的 Galaxy SIII,它会触发正常的文件下载。所需的行为类似于 iOS。

该服务设置了两个重要的标头:

  • Content-Type: text/calendar; charset=utf-8
  • Content-Disposition: inline; filename="event.ics"

我已经解码了我设备的日历应用程序“S Planner”的清单。它没有为text/calendar 数据定义任何BROWSABLE 意图过滤器。它确实定义了一些谷歌日历特有的东西,我不确定我是否可以(ab)使用。

这里来自香草Calendar app

<activity android:name="GoogleCalendarUriIntentFilter" android:label="@string/app_label"
   android:theme="@android:style/Theme.NoDisplay"
   android:configChanges="orientation|keyboardHidden">

   <intent-filter
      android:priority="50">
      <action android:name="android.intent.action.VIEW" />
      <category android:name="android.intent.category.DEFAULT" />
      <category android:name="android.intent.category.BROWSABLE" />
      <data android:scheme="http" android:host="www.google.com" android:pathPrefix="/calendar/event" />
      <data android:scheme="https" android:host="www.google.com" android:pathPrefix="/calendar/event" />
      <data android:scheme="http" android:host="www.google.com" android:pathPattern="/calendar/hosted/.*/event" />
      <data android:scheme="https" android:host="www.google.com" android:pathPattern="/calendar/hosted/.*/event" />
   </intent-filter>
</activity>

这是一个死胡同吗?还有其他不会影响用户体验的解决方案吗?

【问题讨论】:

    标签: android http calendar icalendar


    【解决方案1】:

    问题:

    据我所知,GoogleCalendar 应用程序作为开源提供,而像Samsung,Htc,Sony 这样的设备制造商习惯于在构建各自的Android source 代码时替换默认的modify or publish their own application

    所以有两种可能: Google 没有在默认应用中添加此类功能,或者Samsung 已通过修改源删除了该功能。

    简而言之,这个任务很难或者不可能完成。

    当我遇到这个问题时,我应用了以下解决方案。

    解决方案:

    您可以在应用程序中显示类似用户界面的日历并在其中表示事件。

    如果您愿意,可以使用 3rd 方库来创建这样的界面。

    首先以编程方式读取event.ics 文件并提取其数据。 然后通过使用像 Caldroid 这样的第三方库,您可以在其中表示特定日期的事件。

    希望对你有帮助!!

    【讨论】:

    • 谢谢。我实际上需要将事件数据存储在用户的日历中(用于提醒等) - 我无法添加任何在浏览器之外运行的代码。从那以后,我查找了香草源,我至少很高兴地说三星没有做这种愚蠢的事情;)。
    猜你喜欢
    • 2012-02-13
    • 1970-01-01
    • 1970-01-01
    • 2011-08-24
    • 1970-01-01
    • 2011-11-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多