开发者

Calendar insert on Galaxy S not syncing to Google Calendar

开发者 https://www.devze.com 2023-02-02 18:17 出处:网络
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).

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 G开发者_Python百科oogle 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.


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消