HOWTO: sync s60v3 phone to Google Calendar and make backups of contacts/calendar/notes (in Ubuntu/Linux)

I’ve used a SyncML capable phone since May 2006. SyncML is a great way to synchronize my phone and some of its data to outside sources. I also try to put all my events and happening to my calendar either by the phone itself or by Google Calendar. I’ve subscribed to several Internet calendars in addition to my own in Google Calendar, notable ones are:

  • Ubuntu Fridge Events
  • Facebook friends birthdays
  • Facebook event invitations
  • Finnish Open source events
  • Finnish public holidays and events
  • My friends travel schedule

I also hate Evolution, and have a dislike for Sunbird after using both for several years. Currently my desktop calendar system is mainly Google calendar, my phone and for quick looks while offline, orage. Orage doesn’t currently come with an option of subscribing to online calendars, but that can be easily solved.

What I don’t like is synchronizing these by hand. Things should be automatic, easy and happen without me noticing a thing. Here in picture comes my home server, bluetooth dongle, crontab, msynctool and wget.

Most important part of this setup is msynctool. I use it to synchronize my phone with Google cal automatically with cronjobs.
53 */8 * * * msynctool --conflict n --sync google-phone 2>/dev/null 1>/dev/null
msynctool needs configuration:

  1. first of all, you need multisync-tools and some plugins for opensync, and of course software for bluetooth. My pesky Dell Optiplex GX50 running as my homeserver runs with Ubuntu Hardy 8.04.1 LTS, to which I’ve installed multisync-tools from a PPA:
    deb hardy main
    and have installed atleast opensync-plugin-file opensyncutils opensync-plugin-google-calendar opensync-plugin-irmc opensync-plugin-syncml multisync-tools
    In Intrepid the needed tools are available from the normal intrepid repositories.
  2. figure out your phone settings. Make sure your phones bluetooth is visible to outside queries, and do a scan to acquire the bluetooth MAC address:
    myrtti@kengu:~$ hcitool scan
    Scanning ...
    00:1C:D4:4C:93:AA Nasu

    and check the channel for SyncML:
    myrtti@kengu:~$ sdptool search --bdaddr 00:1C:D4:4C:93:AA SYNCML
    Searching for SYNCML on 00:1C:D4:4C:93:AA ...
    Service Name: SyncMLClient
    Service RecHandle: 0x1000b
    Service Class ID List:
    UUID 128: 00000002-0000-1000-8000-0002ee000002
    Protocol Descriptor List:
    "L2CAP" (0x0100)
    "RFCOMM" (0x0003)
    Channel: 10
    "OBEX" (0x0008)
    Language Base Attr List:
    code_ISO639: 0x454e
    encoding: 0x6a
    base_offset: 0x100
    Profile Descriptor List:
    "" (0x00000002-0000-1000-8000-0002ee000002)
    Version: 0x0100

    In this case the channel is 10.

  3. Try if the connection to your phone works with:
    syncml-obex-client -b 00:1C:D4:4C:93:AA 10 --slow-sync text/x-vcalendar Calendar --identifier "PC Suite" --wbxml
  4. you need to configure the synchronization group. As stated in man msynctool, this is done by:
    msynctool --addgroup <groupname>
    in this case, let’s do two groups, google-phone and file-backup.

    After creating the groups, you need to add members to them:
    msynctool --addmember google-phone google-calendar
    msynctool --addmember google-phone syncml-obex-client

    msynctool --addmember file-backup syncml-obex-client
    msynctool --addmember file-backup file-sync

  5. Now that you have members added, you need to configure them. For the first group we added, google-phone, the configuring happens with commands
    1. msynctool --configure google-phone 1
      which will open up a file in your favorite editor that looks roughly like this:

      Replace the USER and PASSWORD with your own.
    2. msynctool --configure google-phone 2
      which will open up a file in your favorite editor that looks roughly like this:
      <?xml version="1.0"?>
      <!-- (Only for bluetooth) The bluetooth address if the bluetooth mode is selected -->
      <!-- (Only for bluetooth) The bluetooth channel to use. `sdptool browse $MAC` to search for the correct channel -->
      <!-- (Only for USB) The usb interface number of the SYNCML-SYNC target. use syncml-obex-client -u (you will need access to the USB raw device) to find it. -->
      <!-- The string that the plugin will use to identify itself. Some devices need a special string here. -->
      <identifier>Google Calendar</identifier>
      <!-- The syncml version to use: 0 for 1.0, 1 for 1.1 and 2 for 1.2 -->
      <!-- if the plugin should use wbxml -->
      <!-- The username to use. Leave empty to not require a username -->
      <!-- the password for the username -->
      <!-- sets the connection type to use. 5 means obex over usb, 2 means obex over bluetooth -->
      <!-- If wbxml is enabled, defines wether the wbxml should use string tables -->
      <!-- Never send ADD command, but send REPLACE (not needed normally) -->
      <!-- Workaround around for mobile phones which only use local timestamps and _no_ UTC timestamps! -->
      <!-- Sets the maximum allowed size in bytes of incoming messages (some device need this option set). Example: 10000 -->
      <!-- The name of the contacts db. Must be the same as the phones sends -->
      <contact_db>Contacts </contact_db>
      <!-- The name of the calendar db. Must be the same as the phones sends -->
      <calendar_db>Calendar </calendar_db>
      <!-- The name of the note db. Must be the same as the phones sends -->
      <note_db>Notes </note_db>

      Save this file to your home directory or somewhere else accessible, because we’ll need this for configuring the file-backup group!

    and for the second group, file-backup, with

    1. msynctool --configure file-backup 1
      which will require the exact same configurations as google-phone member 2 did, so now just replace the dummy file with the one you saved in the previous step WITH ONE EXCEPTION:
      <identifier>File Backup</identifier>
    2. msynctool --configure file-backup 2
      which will be a XML file a bit like this:
      <?xml version="1.0"?>
      <!-- directory path for file-sync -->
      <!-- should care of subdirectories (TRUE or FALSE) -->

      Note that you need to create a directory for the filesync, in this case it would be /home/myrtti/.phonebackup
  6. Main-ToolsNew-sync-profile To configure your phone, go to Menu – Tools – Sync and add:
    1. Synchronization profile for File Backup
      1. File-backup-profile
      2. Connection-settings-filebackup
      3. Connection-settings-general
      4. Define-datasources-filebackup
    2. Synchronization profile for Google Calendar
      1. Google-calendar-profile
      2. Connection-settings-gcal
      3. Connection-settings-general
      4. Define-datasources-gcal
      5. Calendar Synchronization settings
  7. now you should be able to synchronize your phone using the commands

    msynctool --conflict n --sync google-phone
    msynctool --conflict n --sync file-backup

    and add it them to your cronjobs as in the example in the beginning of this entry.
  8. As the final touch for those of you who use Orage, do a cronjob:
    10 * * * * wget -O ~/.personal.ics
    where the URL fetched is the private iCal URL that you can get from your Google Calendar sharing settings. Similar procedure can be done with other iCal’s you find on the web, after which you can import them to your Orage with the foreign file import:

    those of you who use Gnome and have evolution-data-server installed, but don’t use Evolution itself for your calendar events (and use Sunbird/Lightning or some other calendar application instead) and still want to make the events to show up in the Gnome clock when you click it, try and enter on your terminal prompt:
    where the URL is again the one acquired from the Google Calendar settings (thanks to topyli for this one!)

BWUH! I’m fairly sure this HOWTO contains more than one mistake, so you might need to fiddle around with your phone and computer more than this lets you assume. I’ve managed to make mine work though with this. A word of warning, though! Keep a good copy of your stuff elsewhere too, and study the meaning of the
[--conflict 1-9/d/i/n] Resolve all conflicts as side [1-9] wins, [d]uplicate, [i]gnore, or keep [n]ewer

The theme I currently use on my phone is Glamurv3

This entry was posted in ICT, Planet Ubuntu, Tips'n'Tricks and tagged , , , , , , , . Bookmark the permalink.

12 Responses to HOWTO: sync s60v3 phone to Google Calendar and make backups of contacts/calendar/notes (in Ubuntu/Linux)

  1. Hype says:

    Wow, great post! I own a Nokia N95, which is based on S60v3 (and i use ubuntu ;D).
    I personnaly “only” use gcalsync to sync my phone to google calendar.
    You seem get more in depth with this. I’ll try that out when i’ll have some time. :]
    Thanks !

  2. Sim says:

    This is a great write-up but there seems to be one bit of information missing. On the phone under the sync profile/Applications/Calendar, what is the remote database called? The phone (N95 8GB) won’t let me complete the sync profile without this info.

    Finally, there might be a mistake in the syntax of the syncml-obex-client command in step 3.On my machine (intrepid) it just returns a usage message. Needs channel number after the address.

  3. Luis says:

    Thanks for the tutorial.
    But I have a problem with Google Calendar. When I use the “default” calendar, I have got any problem. But if I want to use a subscription (I have a Birthday calendar with some friends) I couldn’t. I only can use in the google-plugin; and the private url for a subscription is like…………….b2/basic and it doesn’t work with that.
    Anybody know how to sync my Google Calendar to my symbian nokia phone?

  4. GarykPatton says:

    I think I will try to recommend this post to my friends and family, cuz it’s really helpful.

  5. Jon Prichard says:

    This appears to be what I have been looking-for for a long time. Syncing S60 phone (N82) to Mozilla Sunbird/Lightning.

    Thanks, I’ll give it a go.


    I just found this and was so happy I did not have to go through your looong instructions :-)

    Anyway, it is supposed to sync also email and tasks, but only when I disabled them I got my calendar to sync. But now it does it beautifully directly with the google server.

  7. P.S. It says I can use openid to not have my comments moderated, but it does not say how to do that. I mean, my website url is my openID, but it did not try to authenticate with that?

  8. About the google approach of connecting to an exchange server: Well, it did copy the phone events to gcal once successfully, but after that it mostly says “system error” in the middle of syncing and new events created at either end just don’t appear.

    I like your graphic design btw, is it yours? None of the links in the footer seem to take to any wp theming page.

  9. suyog says:

    Anyone here was able to sync from ubuntu with I mean via Opensync or any other way?
    I am trying to it with SyncEvolution and I have volunteered to help/test guys on that project, basically its part of Intel Moblin.
    I have also joined ubuntu-nokia-users group on launchpad but I didnt see much happening there.

  10. suyog says:

    I was able to sync OVI.comEvolution via syncEvolution. If anyone wants to try out , check link