Skip to content Skip to sidebar Skip to footer

Wearablecalendarcontract Query Doesn't Return Recurring Events

I'm creating a watchface for Android Wear which will display calendar events. Based on this page (and the WatchFace sample provided in the SDK), I managed to query the next events

Solution 1:

You have to use CalendarContract.Instances.BEGIN instead of CalendarContract.Events.DTSTART; thus, you can change the PROJECTION to:

privatestaticfinalString[] PROJECTION = {
        CalendarContract.Calendars._ID, // 0
        CalendarContract.Events.BEGIN, // 1
        CalendarContract.Events.END, // 2
        CalendarContract.Events.DISPLAY_COLOR, // 3
};

The reason is that:

  • Events.DTSTART returns start time of the original created event. Note that this event is often in the past; thus, it's filtered out.
  • Events.BEGIN returns start time of each instance of the event.

Check out source in CalendarEvent.java from my github sample project https://github.com/mtrung/android-WatchFace.

Post a Comment for "Wearablecalendarcontract Query Doesn't Return Recurring Events"