I have a sync adapter that handles syncing calendars and events. I am able to delete normal events just fine. But whenever I delete a recurring event, all the events on my calendar disappear.
One thing I noticed is that whenever I deleted a recurring event, the Instances
table is emptied, which explains the events disappearing. The Events
table is as expected, with the recurring event row deleted from the table.
What is causing this?
I have tried deleting in the following ways:
resolver.delete(
ContentUris.withAppendedId(Events.CONTENT_URI, id),
null,
null
);
resolver.delete(
Events.CONTENT_URI,
Events._ID + " = ?",
new String[]{id}
);
And also as a SyncAdapter
:
resolver.delete(
Events.CONTENT_URI.buildUpon()
.appendQueryParameter(CalendarContract.CALLER_IS_SYNCADAPTER, "true")
.appendQueryParameter(Calendars.ACCOUNT_NAME, account.name)
.appendQueryParameter(Calendars.ACCOUNT_TYPE, account.type)
.build(),
Events._ID + " = ?",
new String[]{id}
);
All methods work correctly on non-recurring events, but all cause the Instances
table to be emptied when deleting a recurring event.
Update
One thing I noticed is that the LogCat spits out the following error
- Application:
system_process
- Tag:
BufferQueue
- PID:
1187
- TID:
1518
[com.android.calendar/com.android.calendar.AllInOneActivity] BufferQueue:drainQueueLocked: timeout waiting on consumer!