Address Book notes

Source: Internet
Author: User

1. Address Book permission statement
<Uses-Permission Android: Name = "android. Permission. read_contacts"/>
<Uses-Permission Android: Name = "android. Permission. write_contacts"/>

2. Table Structure Analysis of the address book
The raw_contacts table only stores the contact ID.
The data table stores contact data, such as mobile phone numbers, names, and email addresses.
Raw_contacts has a one-to-multiple relationship with table data. That is, a foreign key raw_contact_id in the data table is consistent with the primary key in the raw_contacts table.

Parse the main fields of table data:
Mimetype_id field: indicates the meaning of the data. For example, if the value is 5, the phone number is displayed. In mimetypes, a detailed description of the meaning of each number is provided.
Data1: this field is very important. It is used to store various contact data, such as mobile phone numbers, names, and email addresses.
Data2: this field is a description of the data1 field. For example, whether the mobile phone number is used for work or for home use, whether it is used for work or in private life.

The call table is used to store call record data.
 
3. Add a contact to the address book
First, update the raw_contacts table. The table has a _ ID, and then update the data table to store the detailed information in this table.
The data table is not updated before the raw_contacts table. Because the data table has a foreign key raw_contact_id, which is consistent with the primary key _ ID of the raw_contacts table.
Except for _ id, raw_contacts tables are updated only after the data table is updated.
Step 1: add an empty data entry to the raw_contacts table.
Step 2: update data in the data table

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.