Moving SMS-es and contacts from iphone to N900
2010-01-17
3 minutes read

I’ve been using an iphone since late 2007 as my primary phone and so I’ve gotten quite a few contacts and SMS conversations stored on it. Now that Collabora has given me a nice and shiny N900, I wanted to move my contacts and conversations over, but this proved to be a bit more work than expected. Please note that the following procedure worked for me, I have tried to take reasonable steps to prevent anything breaking, but if something breaks, you get to keep both pieces. I am not responsible and this comes with absolutely no warranty. Take backups.

What you need

  • the addressbook and SMS SQLite databases. On my phone, they live in /var/mobile/Library/AddressBook and /var/mobile/Library/SMS.

  • A copy of my iphone-contacts-convert script. It’s written in Perl and should be reasonably easy to understand. Put it in the same directory as AddressBook.sqlitedb.

  • A copy of my iphone-export-sms script. It’s also written in Perl and should also be reasonably easy to understand. Put it in the same directory as sms.db.

  • The smstools program you can get from this thread on talk.maemo.org.

The address book conversion script takes the SQLite database structure and converts that into a VCF file. It should be completely safe to run multiple times (it only does SELECT from the different tables in the contacts database, and you have made backups, haven’t you?).

If it dies with an “Unknown property”, “Unknown label” or other error, you can poke it and see if you can work out what’s wrong or drop me an email and I’ll see if I can help you. Assuming it doesn’t fall over, it will spit out a series of VCards, which you should store in a file, which you then to the N900 and open in the address book. Assuming you have less than 1000 contacts, they should now all be in your address book. If you have more, you need to split the file.

A couple of known limitations:

  • It doesn’t handle some of the attributes, like job title, notes, department, display names, prefix and suffix. None of my contacts used those, so I just didn’t care. Patches to change this accepted. Also, it doesn’t handle custom attributes and birthdays. I intended to handle birthdays, but forgot and I have few enough contacts with birthdays that I just did it by hand.

  • When it hits something it doesn’t know how to handle, it stops and you need to add the relevant handle to the code. I think it is mostly clear, how to, but again, feel free to contact me with any problems.

  • Only tested on firmware version 2.2. Yes, ancient, but it’s what my iphone is running.

  • If you have contacts that are organisations, they will come up with a blank full name. Just edit them on the N900 (pressing edit and then save immediately works fine) and they’ll be automatically fixed.

  • No picture support. This looked a bit involved, so I didn’t do this bit. Should be possible with a bit of effort.

The procedure for exporting and importing SMS-es is a bit more involved. First, export the sms-es by running the perl script. It spits out a tab-separated file which you should copy to the N900 along with the smsimporter program from the smstools thread. Run ./smsimporter foo.csv and you should get all your SMS-es put into the conversation app. I ended up compiling my own smsimporter based on the 0.2.1 from the thread with the UUID patch too. Read the whole thread and it should be fairly clear.

Back to posts