我有一个使用提供程序将日历事件插入 Android 日历的应用程序content://com.android.calendar/events
(对于 Android 2.2,否则它是content://calendar/events
)。
这通常工作得很好,在我的 Nexus One 上,事件被添加并正确同步到谷歌日历。
但是,在 Galaxy S 上,添加到 Google 帐户日历的新事件会在手机上正确显示,但不会同步回 Google 日历。即使在手机设置中强制进行同步后,新事件也不会出现在 Google 日历中(从网络上查看)。
而在同一部手机上,使用内置三星日历应用程序添加到同一 Google 日历的新活动确实会同步到 Google 日历。
有谁知道如何让新事件从 Galaxy S 同步到 Google?
一些代码:我的实际插入是这样完成的:
Builder b = ContentProviderOperation.newInsert("content://com.android.calendar/events").withValues(values);
ops.add(b.build());
getContentResolver().applyBatch("com.android.calendar", ops);
这类似于库存 Android 日历应用程序的插入方式,如 AOSP EditEvent类中所示。