Android/gmail data cleanup

I’ve been a long time user of gmail and so it was natural I got an android phone. Well eventually, after a few windows phones (which I did generally like) anyway. The one problem I’ve found is that there are a few bits of data that really need tidying up for the phone to work ideally. My data has come from a few sources, stuff that’s been added manually to gmail and stuff that was imported from Outlook (since I used to keep my phone numbers synced there with the windows phones).

If the Android (1.6) phone’s contact doesn’t have an actual name then it won’t find it when you try to type it in. This might sound obvious but I was used to typing things like ‘Dominos’ (okay, I should cut down). The data looks relatively correct in that the company name is in the field allocated for company names but unfortunately the phone doesn’t pick that up. The simplest way to work around that is to copy the company name into the regular name field. Since I have quite a lot of contacts like that I figured it would be simplest to script that. Luckily there’s a module for that, WWW::Google::Contacts.


use strict;
use warnings;
use WWW::Google::Contacts;
use Term::ReadKey;

my $user = shift;
print "Enter password: ";
my $pass = ReadLine(0);
print "\n";

my $google = WWW::Google::Contacts->new( username => $user, password => $pass );

my @contacts = $google->contacts->search();

foreach my $c ( @contacts ) {
    if(!$c->full_name) {
        if($c->organization) {
            my $name = $c->organization->[0]->name;
            print "Updating $name\n";

There is one other annoyance that I have with alarms and the calendar but I’ll save that for another day. I actually needed to extend an existing module so I really need to contribute that work back.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s