donderdag 10 maart 2011

Android Calendar API glitches

The Android Calendar API is a bit tricky since it's not official yet so it can and does change from time to time. I won't explain the details on how to use providers. For that check the Android Developer Documentation about Content Providers.

First issue is the URI that changed since the Froyo update. Before Froyo use: "content://calendar". After Froyo you should use: "content://". The "/calendars" and "/events" suffices didn't change.

Another issue was found on Motorola Android Devices. Therefore you should use "content://calendarEx" as URI. Not sure about what the correct URI would be for a Motorola device shipped with Froyo release. If anyone can tell me please do!

Another issue is the fields that are always changing. I got remarks that synchronisation failed for instance. That was due to a new field that indicates if the events need to be synced with the online google calendar or only with the local device calendar.

This is a list of the fields with some sample data on Android 2.2.1 as found on my HTC Desire HD test device. This is for a Birthday, some values were truncated for privacy, everything fetched as a String:

column index=0, column name=originalEvent, column value=null
column index=1, column name=visibility, column value=0
column index=2, column name=rrule, column value=FREQ=YEARLY;BYMONTH=5;BYMONTHDAY=9;INTERVAL=1
column index=3, column name=hide_declined, column value=0
column index=4, column name=reminder_type, column value=1
column index=5, column name=hasAlarm, column value=0
column index=6, column name=suggest_text_2, column value=null
column index=7, column name=rdate, column value=null
column index=8, column name=transparency, column value=0
column index=9, column name=timezone, column value=UTC
column index=10, column name=dtstart, column value=-399168000000
column index=11, column name=_sync_time, column value=null
column index=12, column name=hasAttendeeData, column value=0
column index=13, column name=commentsUri, column value=null
column index=14, column name=description, column value=null
column index=15, column name=reminder_duration, column value=10
column index=16, column name=htmlUri, column value=null
column index=17, column name=_sync_account, column value=SOME_EMAIL
column index=18, column name=_sync_version, column value=null
column index=19, column name=hasExtendedProperties, column value=0
column index=20, column name=last_update_time, column value=null
column index=21, column name=eventLocation, column value=null
column index=22, column name=dtend, column value=null
column index=23, column name=allDay, column value=1
column index=24, column name=organizer, column value=SOME_EMAIL
column index=25, column name=deleted, column value=0
column index=26, column name=url, column value=null
column index=27, column name=originalInstanceTime, column value=null
column index=28, column name=alerts_vibrate, column value=1
column index=29, column name=importance, column value=1
column index=30, column name=selfAttendeeStatus, column value=0
column index=31, column name=eventTimezone, column value=null
column index=32, column name=ownerAccount, column value=SOME_EMAIL
column index=33, column name=_sync_account_type, column
column index=34, column name=lastDate, column value=null
column index=35, column name=guestsCanModify, column value=0
column index=36, column name=guestsCanSeeGuests, column value=1
column index=37, column name=exrule, column value=null
column index=38, column name=selected, column value=1
column index=39, column name=title, column value=SOMEONES Birthday
column index=40, column name=_id, column value=251
column index=41, column name=_sync_id, column value=1251191725-birthday
column index=42, column name=alerts_ringtone, column value=null
column index=43, column name=calendar_id, column value=16
column index=44, column name=access_level, column value=200
column index=45, column name=_sync_local_id, column value=null
column index=46, column name=suggest_text_1, column value=SOMEONES Birthday
column index=47, column name=originalAllDay, column value=null
column index=48, column name=iCalGUID, column value=SOME_HASH_VALUE
column index=49, column name=_sync_dirty, column value=1
column index=50, column name=duration, column value=P1D
column index=51, column name=parentID, column value=null
column index=52, column name=color, column value=-14069126
column index=53, column name=guestsCanInviteOthers, column value=1
column index=54, column name=exdate, column value=null
column index=55, column name=eventStatus, column value=null

Geen opmerkingen:

Een reactie plaatsen