D
D
Danil2020-06-14 12:47:05
Android
Danil, 2020-06-14 12:47:05

How to add contact to android phone book (contacts2.db) via sqlite (ROOT)?

Rooted device, Android 5.1.
Task: programmatically add Nxxx phone numbers to the Android system contact
storage

content insert --uri content://com.android.contacts/raw_contacts --bind account_type:s:ACTYPE --bind account_name:s:ACNAME

content insert --uri content://com.android.contacts/data --bind raw_contact_id:i:1 --bind mimetype:s:vnd.android.cursor.item/phone_v2 --bind data1:s:'+12223334455'

a contact is created and visible in the address book, but it is very slow, 1 second per operation, so it was decided to add Nxxx contacts in batch via sqlite

database When trying to directly add to the /data/data/com.android.providers.contacts/databases database /contacts2.db via sqlite3 - a contact is added to the table, but is not displayed in the phone book.
INSERT INTO "data" VALUES(1,NULL,5,1,0,0,0,0,'+12223334455','+12223334455',NULL,NULL,NULL,NULL,NULL,NULL,'+12223334455','1','3',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);

Perhaps there are more related tables.
I ask for the help of experts, how to insert so that the numbers are correctly displayed in the phone directory of the device?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question