0
votes

I have an app that inserts calendar events into Android calendars using the provider content://com.android.calendar/events (for Android 2.2, else it is content://calendar/events).

This works fine usually, and on my Nexus One the events are added and synced correctly up to Google Calendar.

On the Galaxy S however, new events added to a Google Account calendar appear correctly on the phone, but do not sync back to Google Calendar. Even after forcing a sync to occur in phone settings, the new event does not appear in Google Calendar (viewed from the web).

Whereas on the same phone a new event added to the same Google calendar using the built-in Samsung calendar app does get synced up to Google Calendar.

Does anyone know how I can get the new events to sync to Google from a Galaxy S?

Some code: my actual inserts are done like this:

Builder b = ContentProviderOperation.newInsert("content://com.android.calendar/events").withValues(values);
ops.add(b.build());    
getContentResolver().applyBatch("com.android.calendar", ops);

This is similar to how the stock Android calendar app does inserts, as seen in the AOSP EditEvent class.

2
Bear in mind that the content provider you are using is a feature of an app, not the operating system. That app, and its content provider, may or may not be used on any given device, may or may not be modified on any given device, etc. If I had to guess, Samsung's modified app does not use the content provider interface itself, opting for some other private API that supports synchronization.CommonsWare

2 Answers

3
votes

Please note, when you do stuff like write raw strings such as:

"content://com.android.calendar/events"
"com.android.calendar"

You are using private APIs. There are no guarantees this will work on any particular platform or device, since these are not part of the SDK.

Currently there is no public API for the calendar database.

2
votes

Commonsware is correct. Samsung has modified the calendar app on their phones. The app uses not only the google, exchange, and facebook calendars, but they have also put in a 'collecter' calendar called My Calendar.

The calendar app on the Galxy S with TouchWiz is buggy. Some things work, some do not. There is a known bug that shows all day events ending on the previous day. Until the official update to 2.2 is released, this calendar is unreliable.

Other phone companies may also do the same with their phones because as @hackbod points out there is no public API for the calendar database.