Here we consider that we are adding or deleting the calendar events from code. How to know if the event updates(adding/editing/deleting calendar events) done by 开发者_开发知识库the user on his/her device ?
Not sure it is entirely possible to monitor changes to the Calendar, but you could try:
String[] projection = new String[] { "_id" };
Uri calendars = Uri.parse("content://calendar/calendars");
Cursor managedCursor = managedQuery(calendars, projection, null, null, null);
and then use registerContentObserver (see http://developer.android.com/reference/android/database/Cursor.html#registerContentObserver%28android.database.ContentObserver%29) to monitor the Cursor for changes.
Let me know if that works.
精彩评论