Monday, August 20, 2007

Subscribing MobileCal to Google Calendar

I have just begun looking into subscribing the iPhone calendar to a google calendar. I found the location of the file that contains the calendar data. It is in sqlite3 format and is at:

/private/var/root/Library/Calendar/Calendar.sqlitedb

A quick look through the handy System File and Director Listing at the iPhone Dev Wiki told me that the sqlite libraries are installed and ready for use.

I downloaded a sample c program, compiled it with the toolchain compiler, transferred the compiled program to my iPhone and, voila, access to the sqlite db files on my iPhone. Now all that's left to do is write a program that grabs the calendar data from google calendar and turns that into SQL format.

I found the SQLite Database Browser, and am using that to inspect the Calender.sqlitedb file. I hit a snag, however, it trying to decipher the format that the start_date and end_date are in. I assumed it was in seconds since epoch (since its just a large integer) but while it appears to be in seconds it's actually in seconds since January 1st at 12:00:00 am 2001 instead of since epoch.

I have finished scipting the python file that retrieves the google calendar from the url and enters it into the sqlite database. Yeah! Not so fast...Now MobileCalendar keeps crashing. It doesn't like my recurring events. I can get normal events in there just fine, but recurring ones, no dice....Back to work.

Since I have a semi-function tool for syncing the MobileCal with a Google Calendar I decided to make it a little more user friendly. I used the simple Hello World example and this application launcher class to compile a program that first syncs your calendars and then launches MobileCal. The only problem is that it won't work if you just launch it from the spring board, it only works when launched from the terminal (and likewise from Tapp - which is what I'm doing at the moment). I have posted the progress thus far at Google Code Project Page.

1 comment:

sxt173 said...

Hi SpicyChicken! I know you have been very bust with the great work on rsbt and all...

Do you have a more polished version of Google Calendar Sync...

When I try to run mine, I always get db not found type of message.