Android: Contacts Storage

My Dear Andy,

Hope you are feeling better now.

I know it sucks to store all the email ids and display pictures of each and every individual I ever emailed thru my gmail account.

People who I don’t even speak to anymore and even Dead People X-|

Okay.. so the letter writing idea was lame. Lets just stick to business.


So the size of the Contacts Storage for me was 13.76Mb (with Facebook contacts sync’d as well). 2047 (Useless+Very Useful) Contacts.

Anyway, I figured that only 900 of these Contacts actually have phone numbers.

Because my Motorola Milestone suffer from real RAM issues (just 256Mbs of it and at any given point of time no more than 30Mbs Free).

Yeah Yeah.. i know i Know … My bad!! I should not put all the applications from the market inside it… but that’s what it is meant for right?

I spend 22K for nothing? So because of the Huge size of Contacts Storage the free memory would be less and applications would get Garbage Collected more often :-/ Leaving me 😦 and X-(


So I began to search for ways so that I can reduce the size of the display image each contact has.

Or some way to just sync contacts with Phone numbers. I couldn’t find anything useful.

Even if I use …

a) Display options to show just the contacts with phone numbers

b) sync just one of the categories of contacts (like “My Contacts” or “Family”)

…. the contact storage would remain the same size.

Work Around:

I exported all 2000+ contacts to SDCard (using the ImportExport option in the contacts).

It saved the exported VCard File as “00001.vcf”.

I saved it on my desktop and I wrote a quick Java Program to Read the VCards one by one from a file.

Look inside if it contains a TELEPHONE number. If Yes then save it to the “output.vcf” file.

Help Contacts Storage

HelpContactsStorage to find relevant contacts!


$ java -jar HelpContactsStorage.jar


$ java -jar HelpContactsStorage.jar 00001.vcf


$ java -jar HelpContactsStorage.jar inputFile.vcf finalFile.vcf

Download the Source Code from here. Download sample vcf here.


a) Disable the contacts sync with Google or Facebook.

b) Go to the Display options & Select to show all contacts.

c) place output.vcf on the SDCard.

d) Go to Applications –> All –> Contacts Storage. And Clear Data.

e) Go to contacts, import contacts from the SD Card. Select “output.vcf”

f) Keep the Sync Off.

Prost! 🙂

Original Size: 13Mb

Final Size: 3.5Mb!

10 thoughts on “Android: Contacts Storage

  1. Andy…! LOL.
    Okay 😛 barring that… 😀 nice work & illustration there 😉
    Well.. I really liked the whole idea of taking up the task in your hands 😛 & implementing it via a java program. 🙂 Good Thought.
    The well-written mod log aided piece of code 😀 benefited you A LOT on the space crunch.I mean..YOUR phone would be all WooHoo with an additional free space of 10Mb!! 😛 Right?
    vCards >> too cool.
    Good going you…!

    PS: Doesn’t all that show that I am a dedicated reader & a successful ‘OK’ presser..Huh!? 😀

    • Yeah.. Andy Rocks. 😉

      Now that you have mentioned it, it struck me… 10MBs. Awesome right! That means so many other applications. (ting)

      Yeah.. Java is what comes to mind when I start to thing about writing a piece of code. Its like mother tongue. 😛

      Ideally I should have written an Android application, no need to have Java6 installed on your device right? will do that maybe. 🙂 have fun. &Thanks for the comment. you did it!!

      Hey btw you need a display picture. 😉

    • Lol. Cheers mate. Happy to help!!

      Okay well to preserve what you thought about this, I am gonna quote you… (sms)

      “Dude. your blog is AWESOME! i’ve been looking to do something about all the faltu contacts in my phone….im currently in the process of following the steps on yr blog..!! and its one of the few tech blog of ur that i really appreciate..!!

      Small…but very useful thing you did there…by sharing! 🙂 good going. :-)”

  2. In my gmail contacts, I only see my original ‘mail only’ contacts (except a few who have added their number in their gmail account) I don’t see any phone numbers. Now, why the hell did google think that I’d want same contact list in my phone as I have in gmail account ? If I sync, I get all the mail contacts in my phone book but NO phone contacts in gmail/contacts. Even on my old Nokia 5310, I could export/import contacts separately. Google sucks big time….

    • Thanks for the comment Abhi. Well you do have a point there! Google wants to integrate everything – The Google Ecosystem, but if people don’t save their phone numbers on FB then the FB sync won’t show them on your contact list. So we can safely conclude that everyone has a part to play.. a responsibility. LOLz. But I guess the FB contacts aren’t exported (Good thing?). Anyway, I posted this when I was facing an Internal Storage constraint on my Motorola Milestone. Now that I have SGS2, it doesn’t matter. So if you have this constraint then go ahead and fix it otherwise just change the settings and make it “show phone numbers only”. Save yourself the trouble. Also merge your phone contacts with Google Contacts. There is a trade-off here. Keeping all the contacts on the cloud makes life very simple. I never think about taking a backup of anything before I decide to format my device. All the contacts magically appear on my freshly reset phone. Gives a happy feeling!
      If there is something I can help you with then please let me know. Or we can crowdsource an Android app that’d give us the required functionality. hehe

      and needs some content. What are you planning to do with it? 🙂

  3. Thanks for the reply Nikunj. I am not sure how can I ‘merge phone contacts with Google Contacts’ but I really liked your export->filter->import trick. (I don’t know Java, but since it is a plain text file, I can use shell script as required) Also, I feel in much more control of my ph book after knowing that I can access i as plain text 🙂
    As for my site, for > 1.5 years its featuring the same contents 😀 its more of experimentation (with name servers, DNS, web servers, mail servers etc (anything I can get my hands on for free 😉 ) But there has always been a plan to put something (‘What’ is something, I am still struggling to find out) Now that I know someone can visit my site, that inspiration to put some contents (atleast contact form should be up soon :D)

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