Saturday, December 25, 2010

Saving events to calendar (Galaxy Tab and Galaxy S)

I've had a problem with my application related with calendar sync with Google calendar. Events were being saved into the device's calendar but not synced with Google Calendar on Galaxy S and Galaxy Tab after Froyo update.

After getting a Galaxy Tab I could find that it is now needed to specify "_sync_account_type" when adding events to the calendar. An easy fix as this value can be retrieved from the calendar list of the calendar ContentProvider.

Sample code snippet:
ContentValues values = new ContentValues(); 
values.put("_sync_account_type", **put the retrieved account type here**);