Advertisement
metalx1000

Android Contact Database

Dec 13th, 2022 (edited)
1,746
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.70 KB | None | 0 0
  1. #From Shell/ADB no root or sqlite needed
  2. content query --uri content://com.android.contacts/data --projection display_name:number:data4:contact_id
  3.  
  4. # with root access
  5. /data/data/com.android.providers.contacts/databases/contacts2.db
  6.  
  7. #list tables
  8. sqlite3 contacts2.db ".tables"
  9.  
  10. #get header for each column in contacts table
  11. sqlite3 contacts2.db "PRAGMA table_info(contacts)"
  12.  
  13. #find contact name by phone number
  14. SELECT display_name FROM raw_contacts WHERE _id = (select raw_contact_id from phone_lookup where normalized_number = "+12395555555");
  15.  
  16. #find phone number by name
  17. SELECT normalized_number FROM phone_lookup WHERE raw_contact_id =(SELECT raw_contact_id FROM data WHERE data1 LIKE 'John Smith');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement