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

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

问题描述

我刚刚开始熟悉 Android,今天在一次项目会议上,有人说 Android 没有原生日历应用,所以用户只需使用他们喜欢的任何日历应用即可.

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.

这是真的吗?如果是,我如何以编程方式将事件添加到用户的日历中?他们有共同的 API 吗?

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?

不管怎样,我们的目标可能是 Android 2.x.

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

推荐答案

如何以编程方式将事件添加到用户的日历?

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

哪个日历?

是否有他们共享的通用 API?

Is there a common API they all share?

不,只是有一个用于 Windows 日历应用的它们都共享的通用 API".有一些通用的数据格式(例如 iCalendar)和 Internet 协议(例如 CalDAV),但没有通用的 API.有些日历应用甚至不提供 API.

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.

如果您希望集成特定的日历应用程序,请联系他们的开发人员并确定他们是否提供 API.因此,例如,Mayra 引用的 Android 开源项目中的日历应用程序没有提供文档化和支持的 API.Google 甚至 明确告诉开发人员不要使用这些技术 Mayra 引用的教程中概述.

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.

另一个选项是您可以将事件添加到相关的 Internet 日历中.例如,将事件从 Android 开源项目添加到日历应用程序的最佳方法是通过适当的 GData API 将事件添加到用户的 Google 日历.

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.

更新

Android 4.0(API 级别 14)添加了 CalendarContract ContentProvider.

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

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

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