In the new Contacts API, the contact data is placed in three tables: Contacts, rawcontacts and data. This helps the system better store information about multiple accounts that manage a contact.
First, write in front
1. The content of the contact person is added to a database
com.android.providers.contacts//related to Contacts (database-shared) applications
This database file exists: Data/data/com.android.providers.contacts/database
Contact2.db
2. The contact person's various data, the contact person's telephone, the email and so on exists in the data table
The Raw_contacts table and the data table are a one-to-many number.
The data table stores the details of the contact, and each row in the table stores a specific type of information, such as email, address, or phone. Each line uses a mimetype_id field to indicate what type of data the row stores, referencing the Mimetyps table, which stores the commonly used data types.
If the data table is a phone, then data1 is used to save the phone, data2 the type of phone, such as home phone or mobile phone.
If the data table has a last name and first name, then the data1 is used to save the last name and the name, data2 the saved names, data3 the surname.
If the bank is a mailbox, then the data1 is used to save the address of the mailbox, data2 the type of email to save.
That is, the row master data is different, and the corresponding data1-data15 means different. As a result, we use ContentProvider to add names, telephones, emails, and so on, all of which are operational data tables, not raw_contacts tables, nor contacts tables.
3.cells tables to store call records
4.raw_contacts table
Display_name is used to hold the combination of surname plus name, we can not use ContentProvider directly to the Raw_contacts table of this field to add Names. The right thing to do is to insert a name into the data table and send an update update raw_contacts when the name is inserted in the data table. The Name field, which is used to quickly get the contact name.
By using the ID of this table and a foreign key in the data table, you can know the information of which contact a certain line (such as name line, phone line, rawcontact_id, etc.) belongs to.
I have a variety of contact databases from my own Millet phone address book:
Second, Contact table