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.


Anonymous said...

Useful for me. Thanks a lot.


Great post I would like to thank you for the efforts you have made in writing this interesting and knowledgeable article. TutuApp Android

CNG said...

This is highly informatics, crisp and clear. I think that everything has been described in systematic manner so that reader could get maximum information and learn many things. Cydia iOS 11.3