FORUMS
Remove All Ads from XDA

Extract Android SQLite Databases For Contacts, SMSs, Etc

13 posts
Thanks Meter: 1
 
By k420, Junior Member on 15th July 2010, 10:29 AM
Post Reply Subscribe to Thread Email Thread
Hi All,

I'm a Windows/Web/Database developer and I've decided to bite the bullet and learn some Java and write apps for Android. I've done Hello World and a few other programs and now I want to start playing with things like contacts and SMSs.

To make life easier I want to get copies of the various SQLite databases so that I can write my SQL queries and general play with them in my SQLite admin program on Windows.

I assume that they are just regular SQLite files like I've used in other projects so what I'd like to know if possible is:
  1. Is my assumption about them being regular SQLite files correct?
  2. Where do they live on the phone?
  3. How do I get them off the phone/emulator?
Also, I don't know whether it makes a difference to what I want to do but I've not rooted my phone and don't really want to. Based on that, if it needs rooting to get them I'd be really grateful if anyone happens to have gone through this exercise before and can just attach them to a reply post.

Thanks for your time in advance
 
 
16th July 2010, 08:52 AM |#2  
OP Junior Member
Thanks Meter: 1
 
More
For anyone who's interested, after a load of digging I've found the following:

Contacts = /data/data/com.android.providers.contacts/databases/contacts.db
SMS = /data/data/com.android.providers.telephony/databases/mmssms.db
Bookmarks = /data/data/com.android.browser/databases/browser.db

You can get them off the emulator using the adb pull command. E.g.

adb pull /data/data/com.android.providers.contacts/databases/contacts.db d:\contacts.db

Cheers
The Following User Says Thank You to k420 For This Useful Post: [ View ] Gift k420 Ad-Free
16th March 2016, 08:51 PM |#3  
Junior Member
Thanks Meter: 1
 
More
Quote:
Originally Posted by k420

For anyone who's interested, after a load of digging I've found the following:

Contacts = /data/data/com.android.providers.contacts/databases/contacts.db
SMS = /data/data/com.android.providers.telephony/databases/mmssms.db
Bookmarks = /data/data/com.android.browser/databases/browser.db

You can get them off the emulator using the adb pull command. E.g.

adb pull /data/data/com.android.providers.contacts/databases/contacts.db d:\contacts.db

Cheers

Adding one for Calls :

Calls -
Code:
/data/data/com.android.providers.contacts/databases/contacts2.db
Example to access :
Code:
root@mako:/ #  sqlite3 /data/data/com.android.providers.contacts/databases/contacts2.db
providers.contacts/databases/contacts2.db                                     <
SQLite version 3.7.11 2012-03-20 11:35:50
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .headers on
.headers on
sqlite>.mode column
.mode column
sqlite> select _id,number+random(),duration,name contact_name ,datetime(date/1000, 'unixepoch', 'localtime') timestamp
from calls
where number not like '1832%'
order by _id desc
limit  0 , 6 ;

_id         number+random()       duration    contact_name  timestamp
----------  --------------------  ----------  ------------  -------------------
16396       -7814232970342288419  0                         2016-03-16 14:59:53
16395       -2897789212886021933  112                       2016-03-16 14:27:11
16393       -5099152494103830835  262         Rajaselvam M  2016-03-16 12:28:56
16389       8412659988096325402   13                        2016-03-16 09:36:48
16385       1480282204589577101   125         α«ŕα««α»ěα««  2016-03-16 08:05:07
16384       -1575337348523869115  0           Saami         2016-03-15 22:05:50
sqlite>
Last edited by kesavan2000in; 16th March 2016 at 09:05 PM. Reason: Formated , added adv sql
The Following User Says Thank You to kesavan2000in For This Useful Post: [ View ] Gift kesavan2000in Ad-Free
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes