简体   繁体   English

在 android < 4.0 版中为重复事件添加例外

[英]Adding exceptions to recurring events in android < version 4.0

Microsoft Office Project 2007 introduces effective work weeks and calendar exceptions, where all calendar data is associated with a set of "valid from/to" dates. Microsoft Office Project 2007 引入了有效工作周和日历例外,其中所有日历数据都与一组“有效起始/终止日期”相关联。 -- Microsoft Office Dev Center -- Microsoft Office 开发中心

Google also uses this feature .谷歌也使用了这个功能

Does Android Calendar (pre- ICS ) support these features too? Android日历 (pre- ICS ) 是否也支持这些功能? I tried Googling, but only found incomplete posts, such as https://stackoverflow.com/questions/13633577/android-8-sdk-14-recurring-event-exception .我尝试谷歌搜索,但只找到不完整的帖子,例如https://stackoverflow.com/questions/13633577/android-8-sdk-14-recurring-event-exception

I learned on a separate post that the way to access the calendar was through a content provider , however I have found no working solution我在一篇文章中了解到访问日历的方式是通过内容提供商,但是我没有找到可行的解决方案

(for example, I tried using "content://com.android.calendar/exception" , but it results in an exception saying that it is an unknown url). (例如,我尝试使用"content://com.android.calendar/exception" ,但它导致一个异常,说它是一个未知的 url)。

Any help to steer me in the right direction would be extremely helpful, as I have been Googling to no avail, and this try and try again stuff is not working well.任何引导我朝着正确方向前进的帮助都将非常有帮助,因为我一直在谷歌搜索无济于事,而这种反复尝试的东西效果不佳。

No. Android Calendar exceptions are officially supported starting with ICS (API level 14):不可以。从 ICS(API 级别 14)开始正式支持 Android 日历例外:

CONTENT_EXCEPTION_URI

-- Android Developer Guide -- 安卓开发者指南

Some versions may allow you to use the Uri you discuss, since it is derived from the source code :某些版本可能允许您使用您讨论的Uri ,因为它源自源代码

public static final String AUTHORITY = "com.android.calendar";
public static final Uri CONTENT_EXCEPTION_URI = Uri.parse("content://" + AUTHORITY + "/exception");

//hence, CONTENT_EXCEPTION_URI = Uri.parse("content://com.android.calendar/exception");

however since it is not officially supported, it should not be considered reliable.然而,由于它没有得到官方支持,所以它不应该被认为是可靠的。

To answer your first question, yes, older Android has ability to have exceptions to a repeating event.要回答您的第一个问题,是的,旧版 Android 可以对重复事件设置例外。

Since that API was introduced in API 14, It's probably a lot different than the previous versions' code.由于该 API 是在 API 14 中引入的,它可能与以前版本的代码有很大不同。 This link has some hints on getting events from calendars on older versions.这个链接有一些关于从旧版本的日历中获取事件的提示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM