Android Contacts Fields, Data Table Columns And Data Mimetype Explain

Android contacts information is stored in data table. The data table is saved in SQLite database file /data /data /com.android.providers.contacts /databases /contacts2.db. There are columns data1 to data15 in data table, this article will tell you which column stores what type of contact data.

android contact table data

Which contact info field is saved in which data column is decided by data table mimetype_id column value. Below will explain data mimetype and used data columns relations.

1. vnd.android.cursor.item/email_v2 mimetype.

Class ContactsContract.CommonDataKinds.Email provide below data.

  1. data1 ( string ): store email address.
  2. data2 ( integer ): store email type ( home (1), work (2), other (3), mobile (4)).
  3. data4 ( string ): store email display name.
public static final class Email implements ContactsContract.DataColumnsWithJoins, ContactsContract.CommonDataKinds.CommonColumns {
    public static final String ADDRESS = "data1";
    public static final Uri CONTENT_FILTER_URI = null;
    public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/email_v2";
    public static final Uri CONTENT_LOOKUP_URI = null;
    public static final String CONTENT_TYPE = "vnd.android.cursor.dir/email_v2";
    public static final Uri CONTENT_URI = null;
    public static final String DISPLAY_NAME = "data4";
    public static final Uri ENTERPRISE_CONTENT_FILTER_URI = null;
    public static final Uri ENTERPRISE_CONTENT_LOOKUP_URI = null;
    public static final String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX";
    public static final String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS";
    public static final String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES";
    public static final int TYPE_HOME = 1;
    public static final int TYPE_MOBILE = 4;
    public static final int TYPE_OTHER = 3;
    public static final int TYPE_WORK = 2;

2. vnd.android.cursor.item/im mimetype

Class ContactsContract.CommonDataKinds.Im provide below info.

  1. data1 ( string ) : store instant messager id.
  2. data5 ( integer ) : store im protocol. The value can be such as 0 ( Im.PROTOCOL_AIM)
public static final class Im implements ContactsContract.DataColumnsWithJoins, ContactsContract.CommonDataKinds.CommonColumns {
    public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/im";
    public static final String CUSTOM_PROTOCOL = "data6";
    public static final String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX";
    public static final String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS";
    public static final String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES";
    public static final String PROTOCOL = "data5";
    public static final int PROTOCOL_AIM = 0;
    public static final int PROTOCOL_CUSTOM = -1;
    public static final int PROTOCOL_GOOGLE_TALK = 5;
    public static final int PROTOCOL_ICQ = 6;
    public static final int PROTOCOL_JABBER = 7;
    public static final int PROTOCOL_MSN = 1;
    public static final int PROTOCOL_NETMEETING = 8;
    public static final int PROTOCOL_QQ = 4;
    public static final int PROTOCOL_SKYPE = 3;
    public static final int PROTOCOL_YAHOO = 2;
    public static final int TYPE_HOME = 1;
    public static final int TYPE_OTHER = 3;
    public static final int TYPE_WORK = 2;

3. vnd.android.cursor.item/nickname mimetype.

Class ContactsContract.CommonDataKinds.Nickname provide below info.

  1. data1 : store nickname.
public static final class Nickname implements ContactsContract.DataColumnsWithJoins, ContactsContract.CommonDataKinds.CommonColumns {
    public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/nickname";
    public static final String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX";
    public static final String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS";
    public static final String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES";
    public static final String NAME = "data1";
    public static final int TYPE_DEFAULT = 1;
    public static final int TYPE_INITIALS = 5;
    public static final int TYPE_MAIDEN_NAME = 3;
    /** @deprecated */
    @Deprecated
    public static final int TYPE_MAINDEN_NAME = 3;
    public static final int TYPE_OTHER_NAME = 2;
    public static final int TYPE_SHORT_NAME = 4;

4. vnd.android.cursor.item/organization mimetype.

Class ContactsContract.CommonDataKinds.Organization provide below info.

  1. data1 : Store company.
  2. data4 : Store title.
  3. data5 : Store department.
  4. data6 : Store job description.
  5. data7 : Store symbol.
  6. data9 : Store office location.
public static final class Organization implements ContactsContract.DataColumnsWithJoins, ContactsContract.CommonDataKinds.CommonColumns {
    public static final String COMPANY = "data1";
    public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/organization";
    public static final String DEPARTMENT = "data5";
    public static final String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX";
    public static final String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS";
    public static final String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES";
    public static final String JOB_DESCRIPTION = "data6";
    public static final String OFFICE_LOCATION = "data9";
    public static final String PHONETIC_NAME = "data8";
    public static final String PHONETIC_NAME_STYLE = "data10";
    public static final String SYMBOL = "data7";
    public static final String TITLE = "data4";
    public static final int TYPE_OTHER = 2;
    public static final int TYPE_WORK = 1;

5. vnd.android.cursor.item/phone_v2 mimetype.

Class ContactsContract.CommonDataKinds.Phone provide below info.

  1. data1 : phone number.
  2. data2 : phone type.
public static final class Phone implements ContactsContract.DataColumnsWithJoins, ContactsContract.CommonDataKinds.CommonColumns {
    public static final Uri CONTENT_FILTER_URI = null;
    public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/phone_v2";
    public static final String CONTENT_TYPE = "vnd.android.cursor.dir/phone_v2";
    public static final Uri CONTENT_URI = null;
    public static final Uri ENTERPRISE_CONTENT_FILTER_URI = null;
    public static final String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX";
    public static final String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS";
    public static final String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES";
    public static final String NORMALIZED_NUMBER = "data4";
    public static final String NUMBER = "data1";
    public static final String SEARCH_DISPLAY_NAME_KEY = "search_display_name";
    public static final String SEARCH_PHONE_NUMBER_KEY = "search_phone_number";
    public static final int TYPE_ASSISTANT = 19;
    public static final int TYPE_CALLBACK = 8;
    public static final int TYPE_CAR = 9;
    public static final int TYPE_COMPANY_MAIN = 10;
    public static final int TYPE_FAX_HOME = 5;
    public static final int TYPE_FAX_WORK = 4;
    public static final int TYPE_HOME = 1;
    public static final int TYPE_ISDN = 11;
    public static final int TYPE_MAIN = 12;
    public static final int TYPE_MMS = 20;
    public static final int TYPE_MOBILE = 2;
    public static final int TYPE_OTHER = 7;
    public static final int TYPE_OTHER_FAX = 13;
    public static final int TYPE_PAGER = 6;
    public static final int TYPE_RADIO = 14;
    public static final int TYPE_TELEX = 15;
    public static final int TYPE_TTY_TDD = 16;
    public static final int TYPE_WORK = 3;
    public static final int TYPE_WORK_MOBILE = 17;
    public static final int TYPE_WORK_PAGER = 18;

6. vnd.android.cursor.item/sip_address mimetype.

Class ContactsContract.CommonDataKinds.SipAddress provide below info.

  1. data1 : address.
  2. data2 : address type.
public static final class SipAddress implements ContactsContract.DataColumnsWithJoins, ContactsContract.CommonDataKinds.CommonColumns {
    public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/sip_address";
    public static final String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX";
    public static final String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS";
    public static final String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES";
    public static final String SIP_ADDRESS = "data1";
    public static final int TYPE_HOME = 1;
    public static final int TYPE_OTHER = 3;
    public static final int TYPE_WORK = 2;

7. vnd.android.cursor.item/name mimetype.

Class ContactsContract.CommonDataKinds.StructuredName provide below info.

  1. data1 : display name.
  2. data2 : given name.
  3. data3 : family name.
  4. data4 : prefix.
  5. data5 : middle name.
  6. data6 : suffix.
public static final class StructuredName implements ContactsContract.DataColumnsWithJoins {
    public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/name";
    public static final String DISPLAY_NAME = "data1";
    public static final String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX";
    public static final String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS";
    public static final String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES";
    public static final String FAMILY_NAME = "data3";
    public static final String FULL_NAME_STYLE = "data10";
    public static final String GIVEN_NAME = "data2";
    public static final String MIDDLE_NAME = "data5";
    public static final String PHONETIC_FAMILY_NAME = "data9";
    public static final String PHONETIC_GIVEN_NAME = "data7";
    public static final String PHONETIC_MIDDLE_NAME = "data8";
    public static final String PHONETIC_NAME_STYLE = "data11";
    public static final String PREFIX = "data4";
    public static final String SUFFIX = "data6";

8. vnd.android.cursor.item/postal-address_v2 mimetype.

Class ContactsContract.CommonDataKinds.StructuredPostal provide below info.

  1. data1 : formatted address.
  2. data2 : postal address type.
  3. data4 : street.
  4. data7 : city.
  5. data8 : region.
  6. data9 : postcode.
  7. data10 : country.
public static final class StructuredPostal implements ContactsContract.DataColumnsWithJoins, ContactsContract.CommonDataKinds.CommonColumns {
    public static final String CITY = "data7";
    public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/postal-address_v2";
    public static final String CONTENT_TYPE = "vnd.android.cursor.dir/postal-address_v2";
    public static final Uri CONTENT_URI = null;
    public static final String COUNTRY = "data10";
    public static final String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX";
    public static final String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS";
    public static final String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES";
    public static final String FORMATTED_ADDRESS = "data1";
    public static final String NEIGHBORHOOD = "data6";
    public static final String POBOX = "data5";
    public static final String POSTCODE = "data9";
    public static final String REGION = "data8";
    public static final String STREET = "data4";
    public static final int TYPE_HOME = 1;
    public static final int TYPE_OTHER = 3;
    public static final int TYPE_WORK = 2;

9. vnd.android.cursor.item/identity mimetype.

Class ContactsContract.CommonDataKinds.Identity provide below info.

  1. data1 : identity number.
  2. data2 : namespace ( ssn etc).
public static final class Identity implements ContactsContract.DataColumnsWithJoins {
    public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/identity";
    public static final String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX";
    public static final String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS";
    public static final String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES";
    public static final String IDENTITY = "data1";
    public static final String NAMESPACE = "data2";

10. vnd.android.cursor.item/photo mimetype.

Class ContactsContract.CommonDataKinds.Photo provide below info.

  1. data14 : photo file id.
  2. data15 : photo.
public static final class Photo implements ContactsContract.DataColumnsWithJoins {
    public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/photo";
    public static final String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX";
    public static final String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS";
    public static final String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES";
    public static final String PHOTO = "data15";
    public static final String PHOTO_FILE_ID = "data14";

11. vnd.android.cursor.item/group_membership mimetype.

Class ContactsContract.CommonDataKinds.GroupMembership provide below info.

  1. data1 : reference to groups table _id.
public static final class GroupMembership implements ContactsContract.DataColumnsWithJoins {
    public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/group_membership";
    public static final String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX";
    public static final String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS";
    public static final String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES";
    public static final String GROUP_ROW_ID = "data1";
    public static final String GROUP_SOURCE_ID = "group_sourceid";

12. vnd.android.cursor.item/website mimetype.

Class ContactsContract.CommonDataKinds.Website provide below info.

  1. data1 : website url.
public static final class Website implements ContactsContract.DataColumnsWithJoins, ContactsContract.CommonDataKinds.CommonColumns {
    public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/website";
    public static final String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX";
    public static final String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS";
    public static final String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES";
    public static final int TYPE_BLOG = 2;
    public static final int TYPE_FTP = 6;
    public static final int TYPE_HOME = 4;
    public static final int TYPE_HOMEPAGE = 1;
    public static final int TYPE_OTHER = 7;
    public static final int TYPE_PROFILE = 3;
    public static final int TYPE_WORK = 5;
    public static final String URL = "data1";

13. vnd.android.cursor.item/note mimetype.

Class ContactsContract.CommonDataKinds.Note provide below info.

  1. data1 : contact notes.
public static final class Note implements ContactsContract.DataColumnsWithJoins {
    public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/note";
    public static final String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX";
    public static final String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS";
    public static final String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES";
    public static final String NOTE = "data1";

References

  1. Android Contacts Database Structure

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.