Eli Skoran
Eli Skoran

Reputation: 278

Android, Listener/Observer/Callback on calendar event change

I am writing an application that needs to know when a meeting is added/removed/changed in the calendar.
I know how to get all the data from a calendar using CursorLoader on the calendar uri.
Also i know how to listen to calendar changes using the ContentObserver.

The problem is that the ContentObserver.onChange(boolean selfChange, Uri uri) does not provide information on the changed event. so the only way for me to know what the change was is to load again the entire calendar (or part of it) using the CursorLoader and comparing the old with the new.

Is there a way to "register for changes" on the calendar and receive the events that were changed?

Upvotes: 4

Views: 1717

Answers (2)

Eyal Perry
Eyal Perry

Reputation: 2285

Unfortunately, there is no such option. I even went as far as to reflect the entire Bundle which came with that Intent - nothing. IMHO, some surfaces of the Android API are quite lacking, this is just one of these instances, I guess.

Upvotes: 3

ilyamuromets
ilyamuromets

Reputation: 413

Each event after manual editing event sets CalendarContract.DIRTY = 1 (used to indicate that local, unsynced, changes are present). Find these events. Don't forget to reset this flag (equal 0) after synchronization.

Upvotes: 0

Related Questions