syncgcontacts

syncgcontacts


Synchronize your N9 phonebook 

with multiple gmail accounts


Do you love your N9, but you feel it is kinda limited in the contact management functionalities? Do you think just one account for contacts is limiting you? And, as gmail user, do you feel that contact groups are extremely practical to organize your contacts (for example to choose which contacts should go to the phone and which, instead, are simply email contacts and you dont want to ever have them on the phone), but there's no way to map them to the N9?

With syncgcontacts you can finally overcome these limitations.
Syncgcontacts is an application that uses the gdata-api to fetch contacts from one (or more) GMail accounts, and save them to your N9.
Syncgcontacts can also filter the fetched contacts  by groups.


Get it from Nokia Store


Updates
0.3.0 -- Supports most of the contact fields, the Skype IM field (used only when contacts get merged), and google accounts with a custom email address. Performance optimization and bugfixes. New Icon.


DISCLAIMER:
Syncgcontacts does not work together with N9 built-in MfE functionality. Before you use syncgcontacts, you must disable any contact synchronization account in your phone, such as MfE accounts for contacts. Otherwise you may end up messing your contacts on the gmail account (remote side)!
Also, this application has been tested quite extensively, and has worked well for me, but it is provided without any explicit warranty that it will work, and that it wont mess up your phone.
Finally, this is an application in its very early stage, it can be still quite cumbersome to use at times, and may crash due to various reasons (like connection going off).
If it is used properly, it wont do any irreversible damage (in the worst case you just refresh your contacts from the server), but i take no responsibility for any improper use of this tool


How does it work
Syncgcontacts (currently) simply fetches contacts from one or more gmail accounts, filters them according to user specifications, and finally save them on the phone.
It does not go both ways (yet). This means that, for the moment, you will have to enter new contacts on gmail in some other way, for example by using the gmail.com web frontend. This, however, also means that syncgcontacts wont be able in any way to mess up the contacts on your gmail account


Usage


Usage: /opt/syncgcontacts/bin/syncgcontacts [options]

Options:
  -h, --help            shows this message and exits
  -p, --print           Prints contacts on the phone. Other options specified
                        together with this one will have no effect
  -a ACCOUNTS, --accounts=ACCOUNTS
                        list of accounts to download (comma separated). Only
                        accounts which are configured will be considered
  -d, --delete          Erases all the contacts in the device. Can be used
                        together with -a to erase everything before
                        downloading.  *WARNING* this option will erase all the
                        contacts currently present in your device!
  -n NEWACCOUNT, --newaccount=NEWACCOUNT
                        Configures a new gmail account. Use colon to separate
                        username and password  Specifying other options
                        together will have no effect. The account configured
                        using this option will be usable afterward with -a. To
                        update the password for an already configured account,
                        simply reconfigure it with the new password. Example:
                        -n john.doe:secretpassword .

  Debug Options:
    -P, --printall      Prints all the contacts in the phone, including those
                        from telepathy or other sources
    -D, --deleteall     Deletes all the contacts in the phone, including those
                        from telepathy or other sources



In action
First, we configure our gmail account,  "john.doe@gmail.com" in syncgcontacts,  by running:
/opt/syncgcontacts/bin/syncgcontacts -n john.doe:password     

Note that the username in the commandline above does not contain the @gmail.com suffix.
At this point, to download all the contacts from the gmail account john.doe@gmail.com into our phone, we simply have to run 

/opt/syncgcontacts/bin/syncgcontacts -a john.doe   

To filter by contact groups, syncgcontacts supports the following syntax:
 -a account+includedgroup1+...+includedgroupN-excludedgroup1-...-excludedgroupN
This tells syncgcontacts to add only those contacts that belong to ALL the groups prefixed with + , but which do not belong to ANY of the groups prefixed with -.

Example:
/opt/syncgcontacts/bin/syncgcontacts -a john.doe+Home+Friends-LosAngeles-Seattle

this commands will add only those contacts that belongs to both Home and Friends, but which do not belong neither to LosAngeles, nor to Seattle


Multiple accounts
Syncgcontacts supports multiple (configured) accounts, and let you separate them in the command line by using a comma. So, if you want to sync two accounts, "john.doe" and "john.doe.work", you can do something like:

/opt/syncgcontacts/bin/syncgcontacts -a john.doe+Home+Friends-LosAngeles-Seattle,john.doe.work+IBM+Apple+SanFrancisco-Microsoft

Updating contacts
Syncgcontacts keeps track of which accounts have been already downloaded.
So running the two command lines above in sequence will cause the second one to fetch and add only contacts for the account "john.doe.work".
Likewise, running the two command line above in inverted order will cause first one to download nothing, but only remove the contacts belonging to john.doe.work.
Unfortunately syncgcontacts do not detect for different group specifications, meaning that using it with the same account a second time, but with a different group specification, will have no effect.
However, syncgcontacts has a -d (--delete) option, that erases all the contacts from the phone prior to syncing. This is an option that has to be used with care, but is useful when something went wrong before, and we want a fresh copy of our contacts into the phone, or when we have a different group specification for an account already downloaded.
In such cases we can issue something like:

/opt/syncgcontacts/bin/syncgcontacts -a john.doe+Home+Friends+Seattle-LosAngeles  -d

BE CAREFUL, and before using this option, or even syncgcontacts for the first time, make sure that you have all your contacts on gmail already. if you delete contacts you dont have on the cloud, no one will be able to bring them back :)

Future Work

  • two-way synchronization: ability to push to gmail contacts added on the phone and not present on the server
  • GUI
  • support for other providers 

Screen Shots





Comments and Support

If you have suggestions for improvements, constructive criticism, or you simply need help, you can contact me at THIS address, or maybe just write in the comment section below.
If you also feel that this tool eased your digital life incredibly, you may also consider to donate a few money to the project 


52 comments:

  1. I am really interested in this application, in fact this is one of thing I really didnt like about N9.
    Lack of PIM sync features , even not easy to use SyncML client.
    Does this use SyncML? I had tried syncevolution earlier and it was hit n miss.
    Are you on twitter?

    ReplyDelete
  2. I am @mobileyog on twitter, I will try this app and see how it works.
    Actually I would like if someone develops app which does all complete sync with Google and Ovi or any other providers. Calendar,Tasks,Contacts,Notes :) May be I am asking for too much.

    ReplyDelete
  3. Hello Suyog, that would be indeed very cool :) unfortunately, for now the best we can do is syncing contacts and sms, about the rest i havent checked really.
    But N9 has a lot of synchronization just lying there, it's just that no app or the os itself uses it.

    As for syncgcontacts, it doesnt use syncml no, since, as far as i understood, the support from the google side is somewhat limited.
    It uses google api for contacts, that lets you get all the information about your contacts :)

    ReplyDelete
  4. Hi Paolo, I just downloaded and installed Syncgcontacts from Nokia store on my N9.
    but when i try to run syncgcontacts in terminal, i get message "not found"
    I am able to see /opt/syncgcontacts/bin and files under this.

    Please note that my N9 is incepted. Does that make any difference? I tried with devel-su account also but same issue.

    PS: Captcha for submitting comments on your blog are tooo difficult. It took me 8 tries to send this comment.

    ReplyDelete
  5. Hello Paolo, can you please reply? I am unable to get this syncgcontacts working on my N9.

    ReplyDelete
  6. Hi Suyog, sorry for the late answer.
    I am not sure why you get that.
    Just a wild guess: are you calling it with the full path or without? since syncgcontacts is in /opt/syncgcontacts/bin and the installer does not modify the path, you have to invoke it with the full path.

    If this does not work for you, can you please report the full error message?
    thanks :)

    ReplyDelete
  7. Hi Paolo, Thanks for reply. Using full path did help.
    But I ran command again, with "My Contacts" as group from which I wanted to pull contacts.
    I was able to see during command execution, it was mentioning number of contacts not having photo and many contacts didnt belong to group "My Contacts". Is it because space in group name? Also once it was finished, not a single contact showed up in contacts.

    ReplyDelete
  8. Hi Suyog. That might be, but i am not sure, i should check as soon as i have some time.
    This because i have never used syncgcontacts against the group "My Contacts", and all my groups do not have spaces.
    However, you could do a simple test to see if it work: run it without any group specification.
    Doing so it should be able to pull down all the contacts from your account.
    If that works, then probably it's because of the space. As i said, i dont remember right now if it can cause problem, but i will check it out :)

    ReplyDelete
  9. oh, another thing: the groups specification is case sensitive, so doing +work is not the same as +Work. Apart from that, i tried just now with my account and the command line " -a myaccount+Main -D " and it worked fine :)
    If it goes slow, it is because it downloads all of your contacts first, and then it does the filtering. I should probably optimize it a little, but for the moment it was ok :)

    ReplyDelete
  10. Hi Paolo , I tried again but same problem continues, it shows some progress on command line but no contacts actually get added on phone. Can I send you screenshots?
    Also I checked meeTrainer and looks nice. Sent some donation to you as I appreciate what you have been doing :)

    ReplyDelete
  11. Hi Suyog! Im sorry to read you are still having problems.
    I just added two screenshots here to show you whats the output of syncgcontacts (essentially just a bunch of debug info :))

    You can see that it starts by telling you what accounts will be added and what accounts will be deleted. If you specify -D or -d, all the contacts on the phone will be erased prior to the syncing (check on the instruction whats the difference).

    Then it starts fetching the contacts and tells which contacts have no photo associated.
    Finally it adds the contacts and tells if a contact has the picture already downloaded (it wont be updated, for the moment, i will add an option soon)<

    If you are still having problems i suggest you to do the following (let say your account is john.doe@gmail.com ):
    1) make sure you have all of your phone contact on gmail
    2) delete the directory /home/user/.config/syncgcontacts ( rm -r /home/user/.config/syncgcontacts )
    3) reconfigure your account ( /opt/syncgcontacts/bin/syncgcontacts -n john.doe:yourpass )
    4) try, from the gmail side, to add all of the contacts that you want on your phone to some group having a name without spaces, let say "phonebook" (this should be pretty quick to do on gmail, and also pretty quick to revert )
    5) run syncgcontacts like " /opt/syncgcontacts/bin/syncgcontacts -a john.doe+phonebook -d"

    this last command will delete all of the tracker contacts from your phone, and then start the fetching from the gmail account.
    Be careful with -D, it deletes also non-tracker contacts, meaning your skype contacts and so forth, if you have your skype account enabled.
    It looks like it doesnt delete these contacts on the server side, but it does delete them from your phone, so if you plan to use -D, i suggest you to keep all of your IM accounts disabled, while you try it.

    Hope it will help :) And by the way, thanks a lot for donating! Now we really have to get it working :)

    ReplyDelete
  12. Paolo , Thanks again for reply. I got it working finally after removing config and doing all over again. I created group called "N9" and used that.

    ReplyDelete
  13. Hi Paolo , after brief testing , now I guess its working fine to pull contacts from Google. I wanted to report 3 bugs(???) which I found.
    1) First name and Last name for any contact from Google is lumped together into First name in N9 contacts.
    2) All field headings show up as 'Other' in N9 contacts. Like even if I have mobile or home as heading for some numbers or email they all show as other. Strange thing is that if I try to edit contact everything is in proper field heading there. So its just about not showing up correctly.
    3)Contacts Birthdays and Anniversaries doesn't seem to be getting pulled.

    I hope you can find this feedback useful in further development.

    ReplyDelete
  14. Hi Suyog, great to hear it finally works well for you :)
    Thanks a lot for the feedback. I must admit that, being a syncgcontacts user myself, i was kind of aware of them all, even though they never bothered me too much.
    So the third bug is not really a bug but a lack of feature. I have no contact with bday and anniversary, so i just didnt bother importing those fields.. i guess that now someone is using those, i will add the support :)

    As for the other two problems, they are more of a bug, even though i never bothered to look into that, since the sync is only one way for the moment, and also since i kinda preferred to have only one letter on the contacts without the picture instead of two. But you are right, this shouldnt work like that, and so it's now probably time to fix it.
    I guess I'll look into that for the next release, and will have it fixed, if it is actually possible to fix, let see :)

    ReplyDelete
  15. Great , I wrote review of syncgcontacts on Nokia store too.

    ReplyDelete
  16. Thank you so much! i hope we will be able to do 2 way sync soon :)

    ReplyDelete
  17. Not dead, but on the todo stack. Perhaps i can try to have a look on the name issue, now that you reminded me :)

    ReplyDelete
  18. I actually now remember what the problem was.
    It is google that, from the web interface, does not let you specify first name or last name.
    There's one field for everything.
    The segmentation is therefore pretty complicated. Google itself does it in the wrong way, placing the first part of the name into first name , and last part into last name.
    Meaning that if FullName="Guido van Rossum", firstname is then Guido, and last name is Rossum.
    This was the reason why i decided to keep everything into firstname.

    I guess i could add an option for those who want it splitted

    ReplyDelete
  19. Ok, i did some more research, i found it is possible to edit the name field.
    I will try to add the support into syncgcontacts now :)

    ReplyDelete
  20. So, the issue now seems solved. I will push the update to the ovi store.
    Remember that now one has to keep the contacts in order within GMail, otherwise they wont look nice :)

    ReplyDelete
  21. soon or late i will update the icon, too :)

    ReplyDelete
  22. i should also add an option to configure the behavior of the + and - operators (meaning whether + is applied with ALL or ANY, and likewise -)

    ReplyDelete
  23. Very nice work. An UI would be very appreciated (but not necessary for me (= )

    ReplyDelete
  24. Thanks, i realize that too. but it will come after some commit and, after, synchronize capabilities, mostly because i need them more :)

    ReplyDelete
  25. Hi Paolo!
    Is this a open source product we can help develop further?

    This will be my last hope now when Google diabled MfE for new phones which my N9 counts as after repair :(

    By the way, it says to use the email adress without @google.com. This is in many cases the normal username for email at google. Now, I have a google apps account and will need to use @my.domain to identify properly. Will the app add @google.com or will it just use what ever I add as username which in normal cases is email without @google.com.


    BR
    Erik

    ReplyDelete
    Replies
    1. Hi Erik, i just added the support for different username domains, and it seems to work. I will push rev 0.3 to the store now, but it will take some days before it will reach the phone :)

      Delete
  26. Hello Erik,

    good point, right now it does not support usernames that are not @gmail.com, but i can extend this easily.
    I guess i can try to push it out with the next release.

    cheers,
    P

    ReplyDelete
  27. Regarding to the open-sourceness, it is not, right now. But I'm more and more considering to open it, if i find enough people interested in developing it further (i won't open source it just like this, because i would like to see it alive and improving, not dying).
    So far no-one really expressed any interest into it, and i think there are really few users, mostly because i believe the vast majority is fine with one account without groups filtering.

    Finally, I am trying to add the commit support to it, but it turns out that the gdata-api library is not exactly the nicest api i've ever encountered (to be mild), and when it comes to contact creation, it turns out that the examples provided by google are actually incorrect.
    I honestly do not have time to dig into this. If a solution pops up in the near future, i will continue in this direction, otherwise i will probably forget about it for the moment.

    (the code i am talking about is this: https://developers.google.com/google-apps/contacts/v3/#creating_contacts )

    ReplyDelete
  28. I tried downloading and installing syncgcontacts from Ovi Store on my N9 but installation failed. Has anyone seen this already?

    ReplyDelete
  29. Hi Marko, no, not really. I can try to reinstall, and see if it works. Any specific error you get?

    gtx,
    Paolo

    ReplyDelete
  30. No, I just get an error message in the Store app: "Unable to complete installation. Download file again. Installation error" I tried around 5 times today... Could you send me the .deb file by email. I could try then to install it outside of the Store app.

    Thanks
    Marko

    ReplyDelete
  31. Hi Marko, i can reproduce it.
    I dont know the reason, but it might be because the file has been just updated on the store (now it is supposed to be 0.2.5), but the store is still not updated (i see it is still 0.2.1)

    Maybe in a few hours the new version will pop up and fix the issue. I'm not sure, but before i contact nokia, i would like to wait for the new version to appear on the store

    ReplyDelete
  32. Ok, thanks. I will also wait until the new version appears in the store.

    ReplyDelete
  33. Hello Paolo,

    I tried using you app but got stuck
    http://talk.maemo.org/showpost.php?p=1335439&postcount=3

    Today I got the 0.2.5 update and put my hope into it. But it didn't solve my problem.
    The group trick doesn't work too, it seems like syncgcontacts sees only the first 13 contancts of some list. If I specify a group the ones from the 13 which belong to it get added.

    Can you look into it?
    I would be very thankfull as this app could help me a lot.

    ReplyDelete
  34. Hi paoletto,

    First, thank you for this great script...it's much needed since google has removed activesync for free gmail accounts.

    I'm able to run the script properly, it says that it is adding my account, it shows the correct number of contacts to add and then says "Now filtering and adding". However, it doesn't add anything and drops me into a shell prompt.

    I really don't know what else to do at this point...do you have any ideas?

    Desmo

    ReplyDelete
  35. Hi Desmo, if syncgcontacts does not report any error/exception, then it sounds like the group selection is empty.
    You could do a quick attempt, and add all the contacts you want to have in your phone at some point in time to a contact group, say "Phone" (this in gmail, and it is straightforward to revert, so no worries).
    Then run syncgcontacts with filter for this group (e.g., -a youraccount+Phone ), and see if it then works :)
    (be careful, it's case sensitive)

    ReplyDelete
  36. Hi Paolo,

    Thank you, thank you, thank you!! It works...I just put in my name without any kind of filters and it imported all my contacts along with addresses, notes, birthdays, etc.
    This is such a wonderful tool and the only tool that is available to sync gmail contacts since google removed active sync from free accounts.
    I truly appreciate your work and I hope you support this script as long as you have an N9/00/50.
    Is there a way to make a donation to you?

    Desmo

    ReplyDelete
  37. Paolo,

    One more question...when I add new contacts to my gmail account what is the best way to add those?
    Do I simply rerun the script with -a or should I delete the contacts first and then rerun with -a?
    Is there a way to only remove the contacts that have been imported with syncgcontacts or will all of my contacts be removed (skype, facebook, etc)?

    Desmo

    ReplyDelete
  38. Hi Desmo, glad that it works!
    To update the contacts from one account, for now you have to delete/readd unfortunately. I guess i should add some "update" feature, but for now i kept it simple.

    So, in practice, what you will be doing is -a yourAccountsSpecification -d
    the last -d will be executed first, and when -a is executed, it will find an empty contact list to fill :)
    I'm sorry that the documentation does not say what options can be combined..

    ReplyDelete
  39. this is friggin' brilliant!!! many, many, MANY thanks to the developer! now all it lacks is a GUI. the n9 world needs more people like you bro!

    ReplyDelete
  40. Thanks Oscar, I'm glad this app helped you :)

    ReplyDelete
  41. Hi! I've downloaded your app from nokia store, and i've tried run "/opt/syncgcontacts/bin/syncgcontacts -n john.doe:password" & "/opt/syncgcontacts/bin/syncgcontacts -a john.doe" (with my account of course ;)). Unfortunately i've received errors such as:

    =============================================================================
    WARNING /!\ - MANDATORY SECURITY TOKENS ARE MISSIN
    =============================================================================
    Rejecting QContactFetchRequest.
    Please add an AEGIS manifest to your package requesting following security tokens: TrackerReadAcces, TrackerWriteAccess for /usr/bin/python2.6

    What should I do?

    ReplyDelete
  42. Hi
    It's the first time i hear about this problem. What version of the OS are you using?
    Also, IIRC you have to specify at least one group when you do the syncing.
    something like "/opt/syncgcontacts/bin/syncgcontacts -a john.doe+Group"
    I'm not sure about this, especially since i wrote something else in the documentation :)
    But you can try!

    ReplyDelete
  43. Okay, i've figured out what caused my problem. It's my laziness. Instead of writing whole path twice, i've changed directory to "/opt/syncgcontacts/bin/" and run your app from there, like "./syncgcontacts -n john.doe:password". Now, i've tried full path approach and it works like a charm. Btw, do you have any suspicion why your app returns an errors in my "lazy" approach?

    ReplyDelete
  44. Hi
    I suspect it has something to do with how aegis works (the MeeGo security framework), but i am not an expert of aegis, so i cant say more than this :)

    ReplyDelete
  45. Hello,
    is there any possibility to make scriptfile whitch runs update command /opt/syncgcontacts/bin/syncgcontacts -a john.doe -d by clicking Icon or so? It would make much easier to use it.

    ReplyDelete
  46. Hi Pekka, it sure is, and i think soon there will be new releases of this useful app :) (just have to find the time to push the code on some repo)

    ReplyDelete
  47. Just waiting for it, i know the the challenge to find time.

    ReplyDelete
    Replies
    1. By the way, I found Profilematic very useful to run update command once a day, so I will have automatically updated contacts on my N9. Of course this is only oneway sync from google.

      Delete