How to Restore Your Contacts from Titanium Backup Pro

Discussion in 'Android Tech Support' started by Mike1989, Aug 10, 2014.

  1. Mike1989
    Offline

    Mike1989 New Member

    Joined:
    Aug 10, 2014
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    If you don't already know, Titanium Backup is an app that lets you easily restore different apps and data that you had on a previous ROM. When you install a new custom rom, you have to wipe the phone. Titanium saves the data you want to transfer in a special folder and when you install the new rom, you can easily restore your information from Titanium.

    However, contacts are not something you can transfer easily from Titanium.. even if you made a backup in the first place.

    For most of you, it's likely your contacts are synced with Gmail and you won't really have to worry about getting them from Titanium.. but for some of you, if you're like me... you don't sync with Gmail contacts.

    This presents a problem when you're installing a custom rom and you want all of your contacts.

    The contacts2.db file is a database file. Inside of this file is a unique format of database that is accessible to other files and programs. We need to read this information, translate it into a different format your phone can use.. which will be VCF.

    Here's how:

    Make sure you still backup your contacts before installing your custom rom with Titanium Pro. We will need the backup file it stores.

    Use DROIDEXPLORER to explore your phone and navigate to the folder of the Titanium Pro Backup. Typically, this is just in the internal SD storage. It will be something along the lines of sdcard/0 in the main folder.. or you can get to it by starting from the root of the phone, and going to "storage" then sdcard.
    Note this is NOT the external sd card, but one built into the phone.
    *This may be different on different models.. but if you've gotten this far I'm sure you won't have a problem finding the actual file of the backup Titanium Pro created.

    These files will be compressed files like .gz or .tar. There will be 2-3 of them that have file names starting with com. and the word 'contacts' in the file name. You can't really miss them.

    Copy these files to a local destination on your computer of your choice.

    Extract them. Most of the data you find in there you won't need. Once you extract all of them, look for a folder named "data" which has located within it another 2-3 folders named "data". Keep navigating until you see a file named "contacts2.db".

    This is the only file we need. Save it somewhere you'll remember.

    Next, you need a linux terminal.
    Use UBUNTU. Download it onto a bootable disc or USB from the main website and have your computer BOOT from this source. When it loads, you can use UBUNTU as a demo and not install the full version.

    Create a folder anywhere on the UBUNTU hard disk for you to do some work.
    From UBUNTU, you can still navigate to your windows files.
    Navigate to wherever you saved contacts2.db and copy/paste into the location on UBUNTU.

    You will need to download a script.
    https://github.com/stachre/dump-contacts2db

    Click the dbconverter.sh link and copy and paste the source code you see.
    In the same location where contacts2.db is, right click in UBUNTU and create new empty file.
    Open it up, paste the code, save the file.
    Make sure to rename that file to dbconverter.sh.

    Open up terminal (control + alt + t).

    Make sure to navigate to the folder that you just made.
    Start to do this first by writing ls (short for list).
    This will tell you what directory you're in and what folders are in your location.

    Navigate to each section by writing CD sectionname replacing the sectionname with whatever folder you're trying to navigate to.

    Keep searching until you're in the folder where you have your contacts2.db and dbconverter.sh included.

    Once there, we need to download some resources for the code.

    type in
    sudo apt-get install sqlite3 libsqlite3-dev

    Wait for these to download and complete.
    Once done, tell Ubuntu that the dbconverter.sh file is an executable by typing
    chmod +x dbconverter.sh

    Finally, execute the script.
    ./dbconverter.sh contacts2.db > contacts2.vcf

    Wait for it to complete. VCF file will be placed in same folder you've been working in.
    Copy the file and paste it somewhere in your windows folders since you can't access these locations in Windows.

    Restart into Windows... get the VCF file on your phone.. open the file in ES File explorer and use Contacts as app to open it up.

    It will load all of your contacts.

    One issue is many contacts may repeat themselves. For this, sync your contacts with GMAIL.. login to GMAIL, go to contacts, select all contacts, and select the option to merge duplicates.

    Resync on your phone.
    Last edited: Aug 10, 2014
  2. BHuber09
    Offline

    BHuber09 DF Super Moderator Staff Member

    Joined:
    Feb 1, 2011
    Messages:
    45
    Likes Received:
    19
    Trophy Points:
    8
    Location:
    Atlantis
    I use to have the same problem a while ago. If you go into the contacts app -> menu button -> import/export -> export to SD card. Then it'll back all your contacts up in .vcf on your SD card so after you flash you can do the same steps except click import and bam. All your contacts are right there.


    Not sure if this method works across all devices however i know it worked back I'm my droid X days and works currently on my Note 3.

    Note'd
  3. Mike1989
    Offline

    Mike1989 New Member

    Joined:
    Aug 10, 2014
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Absolutely you're right..
    This would only be if you didn't do that or didn't sync with GMAIL and depended on titanium and already had flashed new ROM.

    As long as you can locate the database file for contacts, it'll work.