Friday, May 28, 2010

New calendar API

The Calendar API (used by Call Log Calendar) has been changed on Froyo.

I've received many emails asking how I had this issue solved. Actually this is only a small change to the content provider URI.

URI past Froyo: content://calendar/
URI after Froyo: content://

You'll need something like this on your code to handle older devices as well:

private static Uri CALENDAR_CALENDARS_URI = Uri.parse("content://calendar/calendars");
private static Uri CALENDAR_CALENDARS_URI_8_PLUS = Uri.parse("content://");

private Uri getCalendarUri() {
    if(Integer.parseInt(Build.VERSION.SDK) <= 7) {
    } else {

There is also Build.VERSION.SDK_INT avaiable since API level 4. But to make my application compatible with api level 3 I had to use Build.VERSION.SDK.