Added in API level 11

Entity


class Entity : BaseColumns, ContactsContract.BaseSyncColumns, ContactsContract.ContactNameColumns, ContactsContract.ContactOptionsColumns, ContactsContract.ContactStatusColumns, ContactsContract.ContactsColumns, ContactsContract.DataColumns, ContactsContract.DataUsageStatColumns, ContactsContract.RawContactsColumns, ContactsContract.StatusColumns, ContactsContract.SyncColumns

A sub-directory of a contact that contains all of its ContactsContract.RawContacts as well as ContactsContract.Data rows. To access this directory append CONTENT_DIRECTORY to the contact URI.

Entity has three ID fields: CONTACT_ID for the contact, RAW_CONTACT_ID for the raw contact and DATA_ID for the data rows. Entity always contains at least one row per constituent raw contact, even if there are no actual data rows. In this case the DATA_ID field will be null.

Entity reads all data for the entire contact in one transaction, to guarantee consistency. There is significant data duplication in the Entity (each row repeats all Contact columns and all RawContact columns), so the benefits of transactional consistency should be weighed against the cost of transferring large amounts of denormalized data from the Provider.

To reduce the amount of data duplication the contacts provider and directory providers implementing this protocol are allowed to provide common Contacts and RawContacts fields in the first row returned for each raw contact only and leave them as null in subsequent rows.

Summary

Constants
static String

The directory twig for this sub-table

static String

The ID of the data row.

static String

The ID of the raw contact row.

Inherited constants
String ACCOUNT_NAME

The name of the account instance to which this row belongs, which when paired with ACCOUNT_TYPE identifies a specific account.

Type: TEXT

String ACCOUNT_TYPE

The type of account to which this row belongs, which when paired with ACCOUNT_NAME identifies a specific account.

Type: TEXT

String DIRTY

Flag indicating that VERSION has changed, and this row needs to be synchronized by its owning account.

Type: INTEGER (boolean)

String SOURCE_ID

String that uniquely identifies this row to its source account.

Type: TEXT

String VERSION

Version number that is updated whenever this row or its related data changes.

Type: INTEGER

String ACCOUNT_TYPE_AND_DATA_SET

A concatenation of the account type and data set (delimited by a forward slash) - if the data set is empty, this will be the same as the account type. For applications that need to be aware of the data set, this can be used instead of account type to distinguish sets of data. This is never intended to be used for specifying accounts.

This column does *not* escape forward slashes in the account type or the data set. If this is an issue, consider using ContactsContract.RawContacts.ACCOUNT_TYPE and ContactsContract.RawContacts.DATA_SET directly.

String AGGREGATION_MODE

The aggregation mode for this contact.

Type: INTEGER

String BACKUP_ID

Persistent unique id for each raw_contact within its account. This id is provided by its own data source, and can be used to backup metadata to the server. This should be unique within each set of account_name/account_type/data_set

String CONTACT_ID

A reference to the ContactsContract.Contacts._ID that this data belongs to.

Type: INTEGER

String DATA_SET

The data set within the account that this row belongs to. This allows multiple sync adapters for the same account type to distinguish between each others' data. This is empty by default, and is completely optional. It only needs to be populated if multiple sync adapters are entering distinct data for the same account type and account name.

Type: TEXT

String DELETED

The "deleted" flag: "0" by default, "1" if the row has been marked for deletion. When android.content.ContentResolver#delete is called on a raw contact, it is marked for deletion and removed from its aggregate contact. The sync adaptor deletes the raw contact on the server and then calls ContactResolver.delete once more, this time passing the ContactsContract.CALLER_IS_SYNCADAPTER query parameter to finalize the data removal.

Type: INTEGER

String METADATA_DIRTY

Flag indicating that a raw contact's metadata has changed, and its metadata needs to be synchronized by the server.

Type: INTEGER (boolean)

String RAW_CONTACT_IS_READ_ONLY

The "read-only" flag: "0" by default, "1" if the row cannot be modified or deleted except by a sync adapter. See ContactsContract.CALLER_IS_SYNCADAPTER.

Type: INTEGER

String RAW_CONTACT_IS_USER_PROFILE

Flag that reflects whether this raw contact belongs to the user's personal profile entry.

Int AVAILABLE

An allowed value of PRESENCE.

Int AWAY

An allowed value of PRESENCE.

Int CAPABILITY_HAS_CAMERA

An allowed flag of CHAT_CAPABILITY. Indicates that the contact's device has a camera that can be used for video chat (e.g. a front-facing camera on a phone).

Int CAPABILITY_HAS_VIDEO

An allowed flag of CHAT_CAPABILITY. Indicates that the contact's device can display a video feed.

Int CAPABILITY_HAS_VOICE

An allowed flag of CHAT_CAPABILITY. Indicates audio-chat capability (microphone and speaker)

String CHAT_CAPABILITY

Contact's audio/video chat capability level.

Type: INTEGER (one of the values below)

Int DO_NOT_DISTURB

An allowed value of PRESENCE.

Int IDLE

An allowed value of PRESENCE.

Int INVISIBLE

An allowed value of PRESENCE.

Int OFFLINE

An allowed value of PRESENCE.

String PRESENCE

Contact's latest presence level.

Type: INTEGER (one of the values below)

String PRESENCE_CUSTOM_STATUS

String PRESENCE_STATUS

String STATUS

Contact latest status update.

Type: TEXT

String STATUS_ICON

The resource ID of the icon for the source of the status update. This resource should be scoped by the STATUS_RES_PACKAGE.

Type: NUMBER

String STATUS_LABEL

The resource ID of the label describing the source of the status update, e.g. "Google Talk". This resource should be scoped by the STATUS_RES_PACKAGE.

Type: NUMBER

String STATUS_RES_PACKAGE

The package containing resources for this status: label and icon.

Type: TEXT

String STATUS_TIMESTAMP

The absolute time in milliseconds when the latest status was inserted/updated.

Type: NUMBER

String CARRIER_PRESENCE

Carrier presence information.

Type: INTEGER (A bitmask of CARRIER_PRESENCE_* fields)

Int CARRIER_PRESENCE_VT_CAPABLE

Indicates that the entry is Video Telephony (VT) capable on the current carrier. An allowed bitmask of CARRIER_PRESENCE.

String DATA1

Generic data column, the meaning is MIMETYPE specific

String DATA10

Generic data column, the meaning is MIMETYPE specific

String DATA11

Generic data column, the meaning is MIMETYPE specific

String DATA12

Generic data column, the meaning is MIMETYPE specific

String DATA13

Generic data column, the meaning is MIMETYPE specific

String DATA14

Generic data column, the meaning is MIMETYPE specific

String DATA15

Generic data column, the meaning is MIMETYPE specific. By convention, this field is used to store BLOBs (binary data).

String DATA2

Generic data column, the meaning is MIMETYPE specific

String DATA3

Generic data column, the meaning is MIMETYPE specific

String DATA4

Generic data column, the meaning is MIMETYPE specific

String DATA5

Generic data column, the meaning is MIMETYPE specific

String DATA6

Generic data column, the meaning is MIMETYPE specific

String DATA7

Generic data column, the meaning is MIMETYPE specific

String DATA8

Generic data column, the meaning is MIMETYPE specific

String DATA9

Generic data column, the meaning is MIMETYPE specific

String DATA_VERSION

The version of this data record. This is a read-only value. The data column is guaranteed to not change without the version going up. This value is monotonically increasing.

Type: INTEGER

String IS_PRIMARY

Whether this is the primary entry of its kind for the raw contact it belongs to.

Type: INTEGER (if set, non-0 means true)

String IS_READ_ONLY

The "read-only" flag: "0" by default, "1" if the row cannot be modified or deleted except by a sync adapter. See ContactsContract.CALLER_IS_SYNCADAPTER.

Type: INTEGER

String IS_SUPER_PRIMARY

Whether this is the primary entry of its kind for the aggregate contact it belongs to. Any data record that is "super primary" must also be "primary".

Type: INTEGER (if set, non-0 means true)

String MIMETYPE

The MIME type of the item represented by this row.

String PREFERRED_PHONE_ACCOUNT_COMPONENT_NAME

The flattened android.content.ComponentName of a that is the preferred PhoneAccountHandle to call the contact with.

On a multi-SIM device this field can be used in a CommonDataKinds.Phone row to indicate the PhoneAccountHandle to call the number with, instead of using android.telecom.TelecomManager#getDefaultOutgoingPhoneAccount(String) or asking every time.

android.telecom.TelecomManager#placeCall(Uri, android.os.Bundle) should be called with android.telecom.TelecomManager#EXTRA_PHONE_ACCOUNT_HANDLE set to the PhoneAccountHandle using the ComponentName from this field.

String PREFERRED_PHONE_ACCOUNT_ID

The ID of a that is the preferred PhoneAccountHandle to call the contact with. Used by CommonDataKinds.Phone.

On a multi-SIM device this field can be used in a CommonDataKinds.Phone row to indicate the PhoneAccountHandle to call the number with, instead of using android.telecom.TelecomManager#getDefaultOutgoingPhoneAccount(String) or asking every time.

android.telecom.TelecomManager#placeCall(Uri, android.os.Bundle) should be called with android.telecom.TelecomManager#EXTRA_PHONE_ACCOUNT_HANDLE set to the PhoneAccountHandle using the id from this field.

String RES_PACKAGE

The package name to use when creating Resources objects for this data row. This value is only designed for use when building user interfaces, and should not be used to infer the owner.

String SYNC1

Generic column for use by sync adapters.

String SYNC2

Generic column for use by sync adapters.

String SYNC3

Generic column for use by sync adapters.

String SYNC4

Generic column for use by sync adapters.

String CONTACT_CHAT_CAPABILITY

Contact Chat Capabilities. See StatusUpdates for individual definitions.

Type: NUMBER

String CONTACT_PRESENCE

Contact presence status. See StatusUpdates for individual status definitions.

Type: NUMBER

String CONTACT_STATUS

Contact's latest status update.

Type: TEXT

String CONTACT_STATUS_ICON

The resource ID of the icon for the source of contact status. This resource is scoped by the CONTACT_STATUS_RES_PACKAGE.

Type: NUMBER

String CONTACT_STATUS_LABEL

The resource ID of the label describing the source of contact status, e.g. "Google Talk". This resource is scoped by the CONTACT_STATUS_RES_PACKAGE.

Type: NUMBER

String CONTACT_STATUS_RES_PACKAGE

The package containing resources for this status: label and icon.

Type: TEXT

String CONTACT_STATUS_TIMESTAMP

The absolute time in milliseconds when the latest status was inserted/updated.

Type: NUMBER

String CONTACT_LAST_UPDATED_TIMESTAMP

Timestamp (milliseconds since epoch) of when this contact was last updated. This includes updates to all data associated with this contact including raw contacts. Any modification (including deletes and inserts) of underlying contact data are also reflected in this timestamp.

String DISPLAY_NAME

The display name for the contact.

Type: TEXT

String HAS_PHONE_NUMBER

An indicator of whether this contact has at least one phone number. "1" if there is at least one phone number, "0" otherwise.

Type: INTEGER

String IN_DEFAULT_DIRECTORY

Flag that reflects whether the contact exists inside the default directory. Ie, whether the contact is designed to only be visible outside search.

String IN_VISIBLE_GROUP

Flag that reflects the Groups.GROUP_VISIBLE state of any CommonDataKinds.GroupMembership for this contact.

String IS_USER_PROFILE

Flag that reflects whether this contact represents the user's personal profile entry.

String LOOKUP_KEY

An opaque value that contains hints on how to find the contact if its row id changed as a result of a sync or aggregation.

String NAME_RAW_CONTACT_ID

Reference to the row in the RawContacts table holding the contact name.

Type: INTEGER REFERENCES raw_contacts(_id)

String PHOTO_FILE_ID

Photo file ID of the full-size photo. If present, this will be used to populate PHOTO_URI. The ID can also be used with ContactsContract.DisplayPhoto.CONTENT_URI to create a URI to the photo. If this is present, PHOTO_ID is also guaranteed to be populated.

Type: INTEGER

String PHOTO_ID

Reference to the row in the data table holding the photo. A photo can be referred to either by ID (this field) or by URI (see PHOTO_THUMBNAIL_URI and PHOTO_URI). If PHOTO_ID is null, consult PHOTO_URI or PHOTO_THUMBNAIL_URI, which is a more generic mechanism for referencing the contact photo, especially for contacts returned by non-local directories (see Directory).

Type: INTEGER REFERENCES data(_id)

String PHOTO_THUMBNAIL_URI

A URI that can be used to retrieve a thumbnail of the contact's photo. A photo can be referred to either by a URI (this field or PHOTO_URI) or by ID (see PHOTO_ID). If PHOTO_ID is not null, PHOTO_URI and PHOTO_THUMBNAIL_URI shall not be null (but not necessarily vice versa). If the content provider does not differentiate between full-size photos and thumbnail photos, PHOTO_THUMBNAIL_URI and PHOTO_URI can contain the same value, but either both shall be null or both not null.

Type: TEXT

String PHOTO_URI

A URI that can be used to retrieve the contact's full-size photo. If PHOTO_FILE_ID is not null, this will be populated with a URI based off ContactsContract.DisplayPhoto.CONTENT_URI. Otherwise, this will be populated with the same value as PHOTO_THUMBNAIL_URI. A photo can be referred to either by a URI (this field) or by ID (see PHOTO_ID). If either PHOTO_FILE_ID or PHOTO_ID is not null, PHOTO_URI and PHOTO_THUMBNAIL_URI shall not be null (but not necessarily vice versa). Thus using PHOTO_URI is a more robust method of retrieving contact photos.

Type: TEXT

String CUSTOM_RINGTONE

URI for a custom ringtone associated with the contact. If null or missing, the default ringtone is used.

Type: TEXT (URI to the ringtone)

String LAST_TIME_CONTACTED

The last time a contact was contacted.

Caution: If you publish your app to the Google Play Store, this field is obsolete, regardless of Android version. For more information, see the Contacts Provider page.

Type: INTEGER

String PINNED

The position at which the contact is pinned. If PinnedPositions.UNPINNED, the contact is not pinned. Also see PinnedPositions.

Type: INTEGER

String SEND_TO_VOICEMAIL

Whether the contact should always be sent to voicemail. If missing, defaults to false.

Type: INTEGER (0 for false, 1 for true)

String STARRED

Is the contact starred?

Type: INTEGER (boolean)

String TIMES_CONTACTED

The number of times a contact has been contacted.

Caution: If you publish your app to the Google Play Store, this field is obsolete, regardless of Android version. For more information, see the Contacts Provider page.

Type: INTEGER

String DISPLAY_NAME_ALTERNATIVE

An alternative representation of the display name, such as "family name first" instead of "given name first" for Western names. If an alternative is not available, the values should be the same as DISPLAY_NAME_PRIMARY.

A contacts provider is free to provide alternatives as necessary for its target market. For example the default Android Open Source Project contacts provider currently provides an alternative in a single case: if the display name is based on the structured name and the structured name follows the Western full name style, then the field contains the "family name first" version of the full name. Other cases may be added later.

String DISPLAY_NAME_PRIMARY

The standard text shown as the contact's display name, based on the best available information for the contact (for example, it might be the email address if the name is not available). The information actually used to compute the name is stored in DISPLAY_NAME_SOURCE.

A contacts provider is free to choose whatever representation makes most sense for its target market. For example in the default Android Open Source Project implementation, if the display name is based on the structured name and the structured name follows the Western full-name style, then this field contains the "given name first" version of the full name.

String DISPLAY_NAME_SOURCE

The kind of data that is used as the display name for the contact, such as structured name or email address. See DisplayNameSources.

String PHONETIC_NAME

Pronunciation of the full name in the phonetic alphabet specified by PHONETIC_NAME_STYLE.

The value may be set manually by the user. This capability is of interest only in countries with commonly used phonetic alphabets, such as Japan and Korea. See PhoneticNameStyle.

String PHONETIC_NAME_STYLE

The phonetic alphabet used to represent the PHONETIC_NAME. See PhoneticNameStyle.

String SORT_KEY_ALTERNATIVE

Sort key based on the alternative representation of the full name, DISPLAY_NAME_ALTERNATIVE. Thus for Western names, it is the one using the "family name first" format.

String SORT_KEY_PRIMARY

Sort key that takes into account locale-based traditions for sorting names in address books. The default sort key is DISPLAY_NAME_PRIMARY. For Chinese names the sort key is the name's Pinyin spelling, and for Japanese names it is the Hiragana version of the phonetic name.

String LAST_TIME_USED

The last time (in milliseconds) this Data was used.

String TIMES_USED

The number of times the referenced Data has been used.

String SYNC1

Generic column for use by sync adapters.

String SYNC1

Generic column for use by sync adapters.

String SYNC2

Generic column for use by sync adapters.

String SYNC2

Generic column for use by sync adapters.

String SYNC3

Generic column for use by sync adapters.

String SYNC3

Generic column for use by sync adapters.

String SYNC4

Generic column for use by sync adapters.

String SYNC4

Generic column for use by sync adapters.

String _COUNT

The count of rows in a directory.

Type: INTEGER

String _ID

The unique ID for a row.

Type: INTEGER (long)

Constants

CONTENT_DIRECTORY

Added in API level 11
static val CONTENT_DIRECTORY: String

The directory twig for this sub-table

Value: "entities"

DATA_ID

Added in API level 11
static val DATA_ID: String

The ID of the data row. The value will be null if this raw contact has no data rows.

Type: INTEGER

Value: "data_id"

RAW_CONTACT_ID

Added in API level 11
static val RAW_CONTACT_ID: String

The ID of the raw contact row.

Type: INTEGER

Value: "raw_contact_id"