Tuesday, January 13, 2009

A story of Nokia and the Android contact merge

EDIT (April 2010): A number of people have been leaving comments at the bottom with hints and tips - many are less technical than what I've written, so don't forget to check them too! And thanks to everyone who's left a comment.

I just managed to transfer all my contacts from a Nokia to the G1. It's not too hard. Here's how to do it.

But first, some background. (you can skip ahead if you like)

So, uhh, I used to be a Nokia fan boy.
I loved their menu system, and their sleek designs. And they seemed to fix little things about their OS with each iteration.

And then they released the N70, and the N76. And I started to realise that actually, they had no clue whatsoever.
Why's that?
Well, let me tell you.

The N70 is a really really bad design. Everyone I spoke to agreed on this.
Basically, to lock the keypad, you slide it shut. But, it can easily open in your pocket, and start making calls, and destroying your battery.
Or, it could just hit the camera button, which isn't lockable, and starting taking pocket pictures. Again, destroying the battery.
Weak.

The N76 isn't much better. It's a clamshell, so at least the keys are protected, but there are 3 'media' keys on the front, for controlling the music player, which can't be locked. So, again, it's in your pocket, and boom, music starts playing. You look around, trying to spot the annoying person on the tube playing loud music, only to realise it's you.
Weak.

So, when Google gave us all G1s for Christmas, I couldn't have been happier.
Now, there's been a lot of crap in the press about how we've been skanked, because we got a phone instead of cash.
However, I can honestly tell you that for the 3 months leading up to Christmas, all people have been saying is "They should give us all G1s". In fact, if I had shiny pound for every time I'd heard that comment, I'd be a very rich man indeed.


Anyway, on to the problem at hand.

Transferring contacts from Nokia phones to G1.

It's actually pretty easy, but (unless you don't have many contacts) you will need a computer.

Before we begin, be aware that you can just copy them to the Sim card, and then just stick the sim in the G1. But you'll lose a lot of data.


There are 2 options here.
1) Import contacts directly to the Android.
2) Import contacts into Gmail, and let it synch.

Whichever you choose, the first thing you need to do is get the contacts off your Nokia.

Here's a good explanation of that, with pictures. However, don't do all the steps. Stop when you've copied them over.

Basically, if you can't be bothered to click that link (weirdo), you do the following
Go to contacts on your Nokia.
Click options -> mark -> mark all
Click options -> copy -> to memory card
remove the memory card.

Ok, you can pretty much throw away your Nokia now.


Next, if you don't have many contacts, you can just copy them one-by-one into Gmail.
To do this, put the SD card into your Android phone, and then go to menu -> settings -> SD Card -> and tick 'use for USB storage'.
NOTE: Your computer and phone CANNOT talk to the SD card at the same time. You must go into these settings change the tickbox according to what you're trying to do.

Then plug your phone into the computer USB cable. You should see a box that looks something like this

Click 'Open Folder to view Files'.

Then, browser to 'Others/Contacts'.
Open Gmail, go to contacts, click import, and then choose file. Select a vcard file (it'll be something like bill.vcf) and hit ok. The contact will import.

However, if you do have a lot of contacts, this is really boring. So you need to merge the files.
If you have a unix box, you can just type
cat * >> ALL.vcf
If you don't, you'll need a program like this
http://www.fauland.com/af7.htm

Once you've merged your files, you'll need to copy the resulting file to the top of your SD card.
To do this, locate the ALL.vcf file you've just created, and drag it to the top level of the SD card.

Then, open gmail, and import this file.
Alternatively, download this app
http://www.dusystems.com/importContacts.html
and do it directly on the Android phone.

Now, there's one last thing. The pictures won't have come across. So, for this, you'll need some jiggery pokery (and a bit of programming knowledge, I'm afraid).

Here's a Perl program I wrote to extract the images from the VCF files.


#!/usr/bin/perl

use MIME::Base64;

$name = "";
$live = 0;

while(<>) {
if(m/N:/) {
@a = split(/:/, $_);
$name = $a[1];
$name =~ s/\r//g;
$name =~ s/\n//g;
$name =~ s/;//g;
$name =~ s/ /_/g;
}

if(m/X-CLASS/ && $live) {
$live = 0;
$img = decode_base64($base);
open(A, ">$name.jpg");
print A $img;
close(A);
$base = "";
}

if($live) { $base .= $_; }

if(m/PHOTO/) {
print "Got $name\n";
$live = 1;
}
}


It's not wonderful, but it works. Run it in the directory where the the ALL.vcf file is located with something like
photo.pl < ALL.vcf
This will generate one file for each contact who has a photo, called something like bill_jones.jpg

Then, just edit each contact, and add a thumbnail back in (do this on the phone).
There's probably a quicker way to do this, but it worked ok for me.





11 comments:

Unknown said...

I have used Google Sync and it works perfect:

http://www.google.com/support/mobile/bin/answer.py?answer=98265&topic=15015

Anonymous said...

Your article was exactly was I was looking for to migrate my N70 contacts to Android. Thank you.

I think you could do it better if you add this, for Windows users:
To join all VCF files in one, this is the alternative:
Open a MSDOS (console) windows
Change to "Contacts" directory
Just type "type *.vcf >> /ALL.VCF"
and you will get exactly was you do with "cat" in *nix.

See you!!

Gerald Hibbert said...

Thank you both for the updates.

I hope this page helps more people.

Kristanna said...

Nice for for sharing this article.I was searching this information only.I would like to thank Mattias for posting such a nice link.It is very useful for me.

dvd rohlinge

Shivank Gandhi said...

thanks = )

Ted Pavlic said...

Too bad Android's GMail client doesn't import VCF files (or ICS files) attached to e-mails. :( Seems very strange to support exporting contacts to e-mail but not importing. That might make your process here a little simpler. (you could e-mail yourself your VCF and just click on it to import)

Unknown said...

I find the option of synchronisation via gmail is safe and easy. As there are possibilities of data loss in other options.
nexus one

Shajin said...

Google Sync worked perfect for me as well.. Many Thanks!!!

Didn't have to connect to the computer or anything... Over the air sync.. Perfect!

Also retained my existing contacts on my Hero.

The link below might be useful for the newer Nokia phones (E-Series, N-Series, etc)

http://www.google.com/support/mobile/bin/answer.py?answer=98230&cbid=-w48waez3uf7e&src=cb&lev=topic

Blue Atom said...

Great post - thanks. Once I'd cat'ed all my .vcf's into one big file and imported I found it had brought over the contact images also. Result!

Unknown said...

I got my SE Xperia X10 yesterday (which runs android 1.6) and found a rather convenient way to get the contacts from my old Nokia 5500 sport. On the Nokia I just went to the contact list, selected all and sent via bluetooth to my droid-phone. Had to push accept for every single contact, but all info got exactly where it was supposed to be :)

juzhax said...

I think this way is better?

http://www.justin.my/2011/04/how-to-transfer-contact-from-nokia-to-android/