Cannot read recurring events from android calendar programmatically

后端 未结 2 1555
一生所求
一生所求 2020-12-09 13:47

I have followed the tutorial in this link - http://jimblackler.net/blog/?p=151&cpage=2#comment-52767 to access the internal android calendar database (even though it is

2条回答
  •  囚心锁ツ
    2020-12-09 13:56

    Use the Instances table if you need to locate recurring events.

    The URIs for querying it are:

    • instances/when/*/* - All instances between two times (milliseconds)
    • instances/whenbyday/*/* - All instances between two times (days)
    • instances/groupbyday/*/* - Same as whenbyday, but grouped by the start day

    The list of columns in that table are:

    • _id - The ID of this instance
    • event_id - The event it was created from
    • begin - Begin time (milliseconds)
    • end - End time (milliseconds)
    • startDay - Start day of instance
    • endDay - End day of instance
    • startMinute - Minutes since midnight (0..1440)
    • endMinute - Minutes since midnight

    You can also use the columns from the Events and Calendar tables.

    You can see an example on the same page that you linked: http://jimblackler.net/blog/?p=151

    Example:

    String[] projection = new String[] {
            "title", "description", "begin", "eventLocation"
    };
    String selection = "calendar_id = " + calID;
    String path = "instances/when/" + (now - window) + "/" + (now + window);
    String sortOrder = "begin DESC";
    Cursor managedCursor = getCalendarManagedCursor(
            projection, selection, path, sortorder);
    

    Edit: It seems Google got around to document the Calendar Provider. Browse to Calendar Providier | Google Developers for more information.

提交回复
热议问题