how to call sync google calendar

2019-07-02 00:29发布

first of all read the following question

delete events from Calendar Provider on Android

iam having the same problem... so i delete an event and its still visible in calendar ...to make it to make it disappear,i have to tap menu button and press "synchronize" ...

so is there any way to call it programmatically ?

i would ask him there but i dont have 50 reputation :(

// or at least voteup my question so i can ask him there :D

1条回答
迷人小祖宗
2楼-- · 2019-07-02 01:12

As you noticed, deleting an event doesn't really remove the row from the DB until the event is synced to the server. It's quite logical, otherwise the calendar sync adapter would not be able to retrieve event data to send a DELETE request to the server. That's why there is a DELETED column in the event table, which you must check when querying events:

http://developer.android.com/reference/android/provider/CalendarContract.SyncColumns.html#DELETED

By the way if you query Instances instead of Events (which does expansion of recurring events), deleted events are removed automatically from the result.

Forcing synchro would just be a hack, as anyway the network may not be available...

查看更多
登录 后发表回答