Bastian's Blog

Bastian's Blog

Info | HTML | Text | RSS

To Sync or not to Sync…

The beginning

Two weeks ago I got the chance to catch a peek at the Motorola Milestone from a friend of mine. I for sure wanted to wait until the SE X10 will appear on the german market but after this meetup I was not able to resist this shiny piece of hardware and bought it as soon I got back to my computer. Thanks to amazons I was able to hold my new gadget in my hands only 3 days later.

As I was not that familiar with the Android OS I needed to do some research on what applications are available and which will make my daily life easier. I ended up with most of the proposed applications Tobias Schlitt has written about some time ago.

The challenge

As mentioned in the Abstract counting a smartphone to my list of gadgets I wanted to fullfill a long term dream to gather all my contacts from different social networks - like Facebook, Xing, and Linkedin - into one place.

Gathering the information of interest

The most challenging thing was to get the information of interest out of the networks it self. At this point I found out that Xing as well as Linkedin offers a vCard download - thank you very much Xing and Linkedin providing me with a vCard of each of my contacts. So importing them to my list of contacts using the Google contact website or from the internal SD card of the Milestone was very easy.

Alone Facebook made my live very hard in this discipline since there are no computer readable exports available out of the box. After some research I stumbled upon a Facbook-App called get vCard, which did its job on my tiny friend list at that time, like the applications abstract said:

get vCard
let you export your friends information as vCards to import them into your digital address book. The current version works for single friends and small friend lists. There are often problems with large friend lists and "all friends", because the process has to be run in one request and therefore times out often

The first import

After I gathered a selection - I for sure was too lazy to gather all 400+ contacts from the different networks - of contacts I started importing them into my contact list using Googles Contacts application. To do this in a single I merged every single vCard into a big vCard file and passed this to the Google vCard import.

At first everything looked fine; Google nicely reported that the import was successful and even listed all the imported contacts in a collapseable list. Although every contact had its own entry they were leaking of their profile pictures (avatars).

Partly syncronized and never again

The first big shock hit me, when I looked in my Milestone; only a short part of the recent imported contacts were actually syncronized and I did not get a message or hint on this and by the way it even stopped a manual forced syncronization my contacts in general - again no error message.

The first thing I did? Well I went to my bookshelf to choose my copy of "The hitch hikers guide to the galaxy". Just to read the nicely big and golden letters "Don't Panik" on the cover and took a deep breath. After some research I decided not to reset my Milestone to factory settings. Who would do this btw.? Since it imho forces even more maintainance of the phone; think of every custom setting and installed application. Is ist btw possible to download bought applications a second time without the force to pay for is again?

After reading a lot of threads and messages I found out, that Android is very picky on the passed avatar image data, which causes such errors. Again after a deep breath and a peak on the books cover I decided to clear the imported contacts each by each to find out which forces android to quit the import and at the end I found a number of vCard causing the .

Examining the problem

Kore Nordmann pointed me to the fact that Android only seems to understand base_64 encoded information for an avatar image in the imported vCard. So I went to the RFC to read more about the 'PHOTO' section in vCards. The RFC describes two ways of integrating an image in to a vCard.

The frist one is the absolute URL to the avatar image and the second is the base_64 encoded image itself, like Kore already mentioned. I decided to take a look at a VCard exported by Google contacts. Unfortunately Google does not write avatar image infromation into the exported vCard; so I went to the phone and exported the contacts to the sd card. I was lucky. I finally got the desperate need section in a vCard properly showing avatar images on my phone.

Next thing was to find out the dimensions, resolution, and mimetype to be able to transcode the images I get from the vCard exports of the different networks. It turned out the image have to be 96x96px high and wide at an resolution of 72dpi and the mimetype must be a 'image/jpeg'.

The final import

Gathering these findings I managed to convert the information in the 'PHOTO' section to meet the requirements of the android phone and I finally have the avatar images imported with the vCards.

If you like this article, I'd be very pleased if you'd flattr me.



Add new comment

Fields with bold names are mandatory.