如何在Android中添加日历事件? [英] How to add calendar events in Android?

查看:264
本文介绍了如何在Android中添加日历事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚起床,以加快在Android上,并在项目会议今天有人说,Android有没有内置的日历应用程序,所以用户只需使用任何日历应用程序,他们喜欢。

这是不是真的,如果是这样我怎么编程的事件添加到用户的日历?是否有一个共同的API,它们都有?

有关它的价值,我们很可能瞄准的Andr​​oid 2.x的。

解决方案
  

我怎么编程的事件添加到用户的日历?

的日历?

  

有一个通用的API,他们都有着?

没有,无非是有共同的API,他们都有着为Windows日历应用程序。有一些共同的数据格式(例如,的iCalendar)和网际协议(例如,CalDAV的),但没有共同的API。有些日历应用程序甚至不提供的API。

如果有您希望与整合,联系他们的开发人员,并确定他们是否提供了一个API特定的日历应用程序。因此,例如,从Android开源项目的日历应用程序,梅拉引用,不提供的文档和支持的API。谷歌更是把<一个href="http://android-developers.blogspot.com/2010/05/be-careful-with-content-providers.html">explicitly告诉开发商不要使用教程梅拉援引列出的技术。

另一种选择是让你的事件添加到Internet日历中的问题。例如,事件添加到从Android开源项目的日历应用程序的最佳方式是通过适当的GData API的事件添加到用户的谷歌日历。


更新

的Andr​​oid 4.0(API等级14),增加了一个 CalendarContract 的ContentProvider

I'm just getting up to speed on Android, and today in a project meeting someone said that Android has no native calendar app so users just use whatever calendar app they like.

Is this true, and if so how do I programmatically add an event to the user's calendar? Is there a common API they all share?

For what it's worth, we're probably targeting Android 2.x.

解决方案

how do I programmatically add an event to the user's calendar?

Which calendar?

Is there a common API they all share?

No, no more than there is a "common API they all share" for Windows calendar apps. There are some common data formats (e.g., iCalendar) and Internet protocols (e.g., CalDAV), but no common API. Some calendar apps don't even offer an API.

If there are specific calendar applications you wish to integrate with, contact their developers and determine if they offer an API. So, for example, the Calendar application from the Android open source project, that Mayra cites, offers no documented and supported APIs. Google has even explicitly told developers to not use the techniques outlined in the tutorial Mayra cites.

Another option is for you to add events to the Internet calendar in question. For example, the best way to add events to the Calendar application from the Android open source project is to add the event to the user's Google Calendar via the appropriate GData APIs.


UPDATE

Android 4.0 (API Level 14) added a CalendarContract ContentProvider.

这篇关于如何在Android中添加日历事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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