[HOWTO] Recover contacts using recovery

Hi,

You may be facing a situation where Contacts are not available anymore on your phone, from /e/.
For example, I wrote this guide for a user with a broken screen and some contacts not synchronized to /e/ Cloud.

Yes, you can export contacts while in recovery (TWRP) :slight_smile:
It’s quite simple, they are stored in a SQLite database.

First, while in recovery, connect from an ADB-enabled computer :
adb devices

Then copy the databases (you may notice the calllog BTW) :
adb pull /data/data/com.android.providers.contacts/databases/

Now you can browse and export data from contacts2.db using SQLite tools like SQLiteStudio or DB Browser for SQLite.
Hint : take a look at “view_data” view :wink:

Special tools may be available to extract data in usable layout. For example, this one may worth a try : https://thydzik.com/export-android-contacts-contacts2-db-to-vcard-vcf-on-windows/

Or you can try to put the database files as-is in another Android phone (this will overwrite the whole database, of course).

If your contacts have photos, you can also dig into /data/data/com.android.providers.contacts/files/ from an adb shell.

Master Yoda mode : adb tools also includes a command-line mode SQLite3 tool :sweat:

2 Likes