Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Contacts

*** ** * ** ***

```
class Contacts : BaseColumns, ContactsContract.ContactNameColumns, ContactsContract.ContactOptionsColumns, ContactsContract.ContactStatusColumns, ContactsContract.ContactsColumns
```

|---|---|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||
| ↳ | [android.provider.ContactsContract.Contacts](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#) |

Constants for the contacts table, which contains a record per aggregate of raw contacts representing the same person.

### Operations

**Insert**
:   A Contact cannot be created explicitly. When a raw contact is inserted, the provider will first try to find a Contact representing the same person. If one is found, the raw contact's `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContactsColumns#CONTACT_ID:kotlin.String` column gets the _ID of the aggregate Contact. If no match is found, the provider automatically inserts a new Contact and puts its _ID into the `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContactsColumns#CONTACT_ID:kotlin.String` column of the newly inserted raw contact.

**Update**
:   Only certain columns of Contact are modifiable: `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactOptionsColumns#STARRED:kotlin.String`, `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactOptionsColumns#CUSTOM_RINGTONE:kotlin.String`, `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactOptionsColumns#SEND_TO_VOICEMAIL:kotlin.String`. Changing any of these columns on the Contact also changes them on all constituent raw contacts.

**Delete**
:   Be careful with deleting Contacts! Deleting an aggregate contact deletes all constituent raw contacts. The corresponding sync adapters will notice the deletions of their respective raw contacts and remove them from their back end storage.

**Query**
:
    - If you need to read an individual contact, consider using `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_LOOKUP_URI:android.net.Uri` instead of `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_URI:android.net.Uri`.
    - If you need to look up a contact by the phone number, use `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.PhoneLookup#CONTENT_FILTER_URI:android.net.Uri`, which is optimized for this purpose.
    - If you need to look up a contact by partial name, e.g. to produce filter-as-you-type suggestions, use the `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_FILTER_URI:android.net.Uri` URI.
    - If you need to look up a contact by some data element like email address, nickname, etc, use a query against the `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Data` table. The result will contain contact ID, name etc.

## Columns

| Contacts ||||
|---|---|---|---|
| long | `https://developer.android.com/reference/kotlin/android/provider/BaseColumns#_ID:kotlin.String` | read-only | Row ID. Consider using `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#LOOKUP_KEY:kotlin.String` instead. |
| String | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#LOOKUP_KEY:kotlin.String` | read-only | 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. |
| long | NAME_RAW_CONTACT_ID | read-only | The ID of the raw contact that contributes the display name to the aggregate contact. During aggregation one of the constituent raw contacts is chosen using a heuristic: a longer name or a name with more diacritic marks or more upper case characters is chosen. |
| String | DISPLAY_NAME_PRIMARY | read-only | The display name for the contact. It is the display name contributed by the raw contact referred to by the NAME_RAW_CONTACT_ID column. |
| long | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#PHOTO_ID:kotlin.String` | read-only | Reference to the row in the `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Data` table holding the photo. That row has the mime type `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.CommonDataKinds.Photo#CONTENT_ITEM_TYPE:kotlin.String`. The value of this field is computed automatically based on the `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.DataColumns#IS_SUPER_PRIMARY:kotlin.String` field of the data rows of that mime type. |
| long | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#PHOTO_URI:kotlin.String` | read-only | A URI that can be used to retrieve the contact's full-size photo. This column is the preferred method of retrieving the contact photo. |
| long | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#PHOTO_THUMBNAIL_URI:kotlin.String` | read-only | A URI that can be used to retrieve the thumbnail of contact's photo. This column is the preferred method of retrieving the contact photo. |
| int | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#IN_VISIBLE_GROUP:kotlin.String` | read-only | An indicator of whether this contact is supposed to be visible in the UI. "1" if the contact has at least one raw contact that belongs to a visible group; "0" otherwise. |
| int | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#HAS_PHONE_NUMBER:kotlin.String` | read-only | An indicator of whether this contact has at least one phone number. "1" if there is at least one phone number, "0" otherwise. |
| int | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactOptionsColumns#STARRED:kotlin.String` | read/write | An indicator for favorite contacts: '1' if favorite, '0' otherwise. When raw contacts are aggregated, this field is automatically computed: if any constituent raw contacts are starred, then this field is set to '1'. Setting this field automatically changes the corresponding field on all constituent raw contacts. |
| String | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactOptionsColumns#CUSTOM_RINGTONE:kotlin.String` | read/write | A custom ringtone associated with a contact. Typically this is the URI returned by an activity launched with the `https://developer.android.com/reference/kotlin/android/media/RingtoneManager.html#ACTION_RINGTONE_PICKER:kotlin.String` intent. |
| int | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactOptionsColumns#SEND_TO_VOICEMAIL:kotlin.String` | read/write | An indicator of whether calls from this contact should be forwarded directly to voice mail ('1') or not ('0'). When raw contacts are aggregated, this field is automatically computed: if *all* constituent raw contacts have SEND_TO_VOICEMAIL=1, then this field is set to '1'. Setting this field automatically changes the corresponding field on all constituent raw contacts. |
| int | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactStatusColumns#CONTACT_PRESENCE:kotlin.String` | read-only | Contact IM presence status. See `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.StatusUpdates` for individual status definitions. Automatically computed as the highest presence of all constituent raw contacts. The provider may choose not to store this value in persistent storage. The expectation is that presence status will be updated on a regular basis. |
| String | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactStatusColumns#CONTACT_STATUS:kotlin.String` | read-only | Contact's latest status update. Automatically computed as the latest of all constituent raw contacts' status updates. |
| long | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactStatusColumns#CONTACT_STATUS_TIMESTAMP:kotlin.String` | read-only | The absolute time in milliseconds when the latest status was inserted/updated. |
| String | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactStatusColumns#CONTACT_STATUS_RES_PACKAGE:kotlin.String` | read-only | The package containing resources for this status: label and icon. |
| long | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactStatusColumns#CONTACT_STATUS_LABEL:kotlin.String` | read-only | The resource ID of the label describing the source of contact status, e.g. "Google Talk". This resource is scoped by the `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactStatusColumns#CONTACT_STATUS_RES_PACKAGE:kotlin.String`. |
| long | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactStatusColumns#CONTACT_STATUS_ICON:kotlin.String` | read-only | The resource ID of the icon for the source of contact status. This resource is scoped by the `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactStatusColumns#CONTACT_STATUS_RES_PACKAGE:kotlin.String`. |

<br />

## Summary

| Nested classes ||
|---|---|
|   | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts.AggregationSuggestions` A *read-only* sub-directory of a single contact aggregate that contains all aggregation suggestions (other contacts). |
|   | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts.Data` A sub-directory of a single contact that contains all of the constituent raw contact `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Data` rows. |
|   | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts.Entity` A sub-directory of a contact that contains all of its `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts` as well as `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Data` rows. |
|   | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts.Photo` A *read-only* sub-directory of a single contact that contains the contact's primary photo. |

| Constants ||
|---|---|
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_ITEM_TYPE:kotlin.String` The MIME type of a `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_URI:android.net.Uri` subdirectory of a single person. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_TYPE:kotlin.String` The MIME type of `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_URI:android.net.Uri` providing a directory of people. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_VCARD_TYPE:kotlin.String` The MIME type of a `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_URI:android.net.Uri` subdirectory of a single person. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#EXTRA_ADDRESS_BOOK_INDEX:kotlin.String` Add this query parameter to a URI to get back row counts grouped by the address book index as cursor extras. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#EXTRA_ADDRESS_BOOK_INDEX_COUNTS:kotlin.String` The array of group counts for the corresponding group. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#EXTRA_ADDRESS_BOOK_INDEX_TITLES:kotlin.String` The array of address book index titles, which are returned in the same order as the data in the cursor. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#QUERY_PARAMETER_VCARD_NO_PHOTO:kotlin.String` Boolean parameter that may be used with `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_VCARD_URI:android.net.Uri` and `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_MULTI_VCARD_URI:android.net.Uri` to indicate that the returned vcard should not contain a photo. |

Inherited constants From class `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactStatusColumns` `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactStatusColumns#CONTACT_CHAT_CAPABILITY:kotlin.String`


Contact Chat Capabilities. See `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.StatusUpdates` for individual definitions.

Type: NUMBER

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactStatusColumns#CONTACT_PRESENCE:kotlin.String`


Contact presence status. See `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.StatusUpdates` for individual status definitions.

Type: NUMBER

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactStatusColumns#CONTACT_STATUS:kotlin.String`


Contact's latest status update.

Type: TEXT

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactStatusColumns#CONTACT_STATUS_ICON:kotlin.String`


The resource ID of the icon for the source of contact status. This resource is scoped by the `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactStatusColumns#CONTACT_STATUS_RES_PACKAGE:kotlin.String`.

Type: NUMBER

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactStatusColumns#CONTACT_STATUS_LABEL:kotlin.String`


The resource ID of the label describing the source of contact status, e.g. "Google Talk". This resource is scoped by the `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactStatusColumns#CONTACT_STATUS_RES_PACKAGE:kotlin.String`.

Type: NUMBER

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactStatusColumns#CONTACT_STATUS_RES_PACKAGE:kotlin.String`


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

Type: TEXT

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactStatusColumns#CONTACT_STATUS_TIMESTAMP:kotlin.String`


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

Type: NUMBER

<br />

From class `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns` `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#CONTACT_LAST_UPDATED_TIMESTAMP:kotlin.String`


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.

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#DISPLAY_NAME:kotlin.String`


The display name for the contact.

Type: TEXT

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#HAS_PHONE_NUMBER:kotlin.String`


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

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#IN_DEFAULT_DIRECTORY:kotlin.String`


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

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#IN_VISIBLE_GROUP:kotlin.String`


Flag that reflects the `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.GroupsColumns#GROUP_VISIBLE:kotlin.String` state of any `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.CommonDataKinds.GroupMembership` for this contact.

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#IS_USER_PROFILE:kotlin.String`


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

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#LOOKUP_KEY:kotlin.String`


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.

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#NAME_RAW_CONTACT_ID:kotlin.String`


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

Type: INTEGER REFERENCES raw_contacts(_id)

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#PHOTO_FILE_ID:kotlin.String`


Photo file ID of the full-size photo. If present, this will be used to populate `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#PHOTO_URI:kotlin.String`. The ID can also be used with `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.DisplayPhoto#CONTENT_URI:android.net.Uri` to create a URI to the photo. If this is present, `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#PHOTO_ID:kotlin.String` is also guaranteed to be populated.

Type: INTEGER

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#PHOTO_ID:kotlin.String`


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 `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#PHOTO_THUMBNAIL_URI:kotlin.String` and `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#PHOTO_URI:kotlin.String`). If PHOTO_ID is null, consult `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#PHOTO_URI:kotlin.String` or `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#PHOTO_THUMBNAIL_URI:kotlin.String`, which is a more generic mechanism for referencing the contact photo, especially for contacts returned by non-local directories (see `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory`).

Type: INTEGER REFERENCES data(_id)

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#PHOTO_THUMBNAIL_URI:kotlin.String`


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 `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#PHOTO_URI:kotlin.String`) or by ID (see `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#PHOTO_ID:kotlin.String`). 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 `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#PHOTO_URI:kotlin.String` can contain the same value, but either both shall be null or both not null.

Type: TEXT

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#PHOTO_URI:kotlin.String`


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 `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.DisplayPhoto#CONTENT_URI:android.net.Uri`. Otherwise, this will be populated with the same value as `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#PHOTO_THUMBNAIL_URI:kotlin.String`. A photo can be referred to either by a URI (this field) or by ID (see `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#PHOTO_ID:kotlin.String`). 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

<br />

From class `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactOptionsColumns` `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactOptionsColumns#CUSTOM_RINGTONE:kotlin.String`


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

Type: TEXT (URI to the ringtone)

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactOptionsColumns#LAST_TIME_CONTACTED:kotlin.String`


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](https://developer.android.com/reference/kotlin/guide/topics/providers/contacts-provider#ObsoleteData) page.

Type: INTEGER

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactOptionsColumns#PINNED:kotlin.String`


The position at which the contact is pinned. If `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.PinnedPositions#UNPINNED:kotlin.Int`, the contact is not pinned. Also see `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.PinnedPositions`.

Type: INTEGER

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactOptionsColumns#SEND_TO_VOICEMAIL:kotlin.String`


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

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

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactOptionsColumns#STARRED:kotlin.String`


Is the contact starred?

Type: INTEGER (boolean)

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactOptionsColumns#TIMES_CONTACTED:kotlin.String`


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](https://developer.android.com/reference/kotlin/guide/topics/providers/contacts-provider#ObsoleteData) page.

Type: INTEGER

<br />

From class `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactNameColumns` `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactNameColumns#DISPLAY_NAME_ALTERNATIVE:kotlin.String`


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 `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactNameColumns#DISPLAY_NAME_PRIMARY:kotlin.String`.

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.

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactNameColumns#DISPLAY_NAME_PRIMARY:kotlin.String`


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 `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactNameColumns#DISPLAY_NAME_SOURCE:kotlin.String`.

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.

<br />

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactNameColumns#DISPLAY_NAME_SOURCE:kotlin.String`


The kind of data that is used as the display name for the contact, such as structured name or email address. See `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.DisplayNameSources`.

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactNameColumns#PHONETIC_NAME:kotlin.String`


Pronunciation of the full name in the phonetic alphabet specified by `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactNameColumns#PHONETIC_NAME_STYLE:kotlin.String`.

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 `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.PhoneticNameStyle`.

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactNameColumns#PHONETIC_NAME_STYLE:kotlin.String`


The phonetic alphabet used to represent the `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactNameColumns#PHONETIC_NAME:kotlin.String`. See `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.PhoneticNameStyle`.

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactNameColumns#SORT_KEY_ALTERNATIVE:kotlin.String`


Sort key based on the alternative representation of the full name, `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactNameColumns#DISPLAY_NAME_ALTERNATIVE:kotlin.String`. Thus for Western names, it is the one using the "family name first" format.

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactNameColumns#SORT_KEY_PRIMARY:kotlin.String`


Sort key that takes into account locale-based traditions for sorting names in address books. The default sort key is `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactNameColumns#DISPLAY_NAME_PRIMARY:kotlin.String`. 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.

<br />

From class `https://developer.android.com/reference/kotlin/android/provider/BaseColumns` `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/android/provider/BaseColumns#_COUNT:kotlin.String`


The count of rows in a directory.

Type: INTEGER

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/android/provider/BaseColumns#_ID:kotlin.String`


The unique ID for a row.

Type: INTEGER (long)

<br />

| Public methods ||
|---|---|
| open static [Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)! | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#getLookupUri(android.content.ContentResolver,%20android.net.Uri)(resolver: https://developer.android.com/reference/kotlin/android/content/ContentResolver.html#!, contactUri: https://developer.android.com/reference/kotlin/android/net/Uri.html#!)` Builds a `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_LOOKUP_URI:android.net.Uri` style `https://developer.android.com/reference/kotlin/android/net/Uri.html#` describing the requested `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#` entry. |
| open static [Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)! | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#getLookupUri(kotlin.Long,%20kotlin.String)(contactId: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html, lookupKey: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!)` Build a `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_LOOKUP_URI:android.net.Uri` lookup `https://developer.android.com/reference/kotlin/android/net/Uri.html#` using the given `https://developer.android.com/reference/kotlin/android/provider/BaseColumns#_ID:kotlin.String` and `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#LOOKUP_KEY:kotlin.String`. |
| open static [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#isEnterpriseContactId(kotlin.Long)(contactId: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)` Return `true` if a contact ID is from the contacts provider on the managed profile. |
| open static [Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)! | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#lookupContact(android.content.ContentResolver,%20android.net.Uri)(resolver: https://developer.android.com/reference/kotlin/android/content/ContentResolver.html#!, lookupUri: https://developer.android.com/reference/kotlin/android/net/Uri.html#!)` Computes a content URI (see `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_URI:android.net.Uri`) given a lookup URI. |
| open static [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#markAsContacted(android.content.ContentResolver,%20kotlin.Long)(resolver: https://developer.android.com/reference/kotlin/android/content/ContentResolver.html#!, contactId: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)` Mark a contact as having been contacted. |
| open static [InputStream](https://developer.android.com/reference/kotlin/java/io/InputStream.html#)! | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#openContactPhotoInputStream(android.content.ContentResolver,%20android.net.Uri)(cr: https://developer.android.com/reference/kotlin/android/content/ContentResolver.html#!, contactUri: https://developer.android.com/reference/kotlin/android/net/Uri.html#!)` Opens an InputStream for the contacts's thumbnail photo and returns the photo as a byte stream. |
| open static [InputStream](https://developer.android.com/reference/kotlin/java/io/InputStream.html#)! | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#openContactPhotoInputStream(android.content.ContentResolver,%20android.net.Uri,%20kotlin.Boolean)(cr: https://developer.android.com/reference/kotlin/android/content/ContentResolver.html#!, contactUri: https://developer.android.com/reference/kotlin/android/net/Uri.html#!, preferHighres: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Opens an InputStream for the contacts's photo and returns the photo as a byte stream. |

| Properties ||
|---|---|
| static [Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)! | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_FILTER_URI:android.net.Uri` The content:// style URI used for "type-to-filter" functionality on the `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_URI:android.net.Uri` URI. |
| static [Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)! | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_FREQUENT_URI:android.net.Uri` The content:// style URI for showing a list of frequently contacted people. |
| static [Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)! | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_GROUP_URI:android.net.Uri` <br /> |
| static [Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)! | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_LOOKUP_URI:android.net.Uri` A content:// style URI for this table that should be used to create shortcuts or otherwise create long-term links to contacts. |
| static [Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)! | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_MULTI_VCARD_URI:android.net.Uri` Base `https://developer.android.com/reference/kotlin/android/net/Uri.html#` for referencing multiple `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#` entry, created by appending `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#LOOKUP_KEY:kotlin.String` using `https://developer.android.com/reference/kotlin/android/net/Uri.html#withAppendedPath(android.net.Uri,%20kotlin.String)`. |
| static [Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)! | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_STREQUENT_FILTER_URI:android.net.Uri` The content:// style URI used for "type-to-filter" functionality on the `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_STREQUENT_URI:android.net.Uri` URI. |
| static [Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)! | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_STREQUENT_URI:android.net.Uri` The content:// style URI for this table joined with useful data from `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Data`, filtered to include only starred contacts. |
| static [Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)! | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_URI:android.net.Uri` The content:// style URI for this table |
| static [Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)! | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_VCARD_URI:android.net.Uri` Base `https://developer.android.com/reference/kotlin/android/net/Uri.html#` for referencing a single `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#` entry, created by appending `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#LOOKUP_KEY:kotlin.String` using `https://developer.android.com/reference/kotlin/android/net/Uri.html#withAppendedPath(android.net.Uri,%20kotlin.String)`. |
| static [Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)! | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#ENTERPRISE_CONTENT_FILTER_URI:android.net.Uri` It supports the similar semantics as `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_FILTER_URI:android.net.Uri` and returns the same columns. |
| static [Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#) | `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#ENTERPRISE_CONTENT_URI:android.net.Uri` URI used for getting all contacts from both the calling user and the managed profile that is linked to it. |

## Constants

### CONTENT_ITEM_TYPE

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val CONTENT_ITEM_TYPE: String
```

The MIME type of a `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_URI:android.net.Uri` subdirectory of a single person.

    Value: "vnd.android.cursor.item/contact"

### CONTENT_TYPE

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val CONTENT_TYPE: String
```

The MIME type of `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_URI:android.net.Uri` providing a directory of people.

    Value: "vnd.android.cursor.dir/contact"

### CONTENT_VCARD_TYPE

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val CONTENT_VCARD_TYPE: String
```

The MIME type of a `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_URI:android.net.Uri` subdirectory of a single person.

    Value: "text/x-vcard"

### EXTRA_ADDRESS_BOOK_INDEX

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_ADDRESS_BOOK_INDEX: String
```

Add this query parameter to a URI to get back row counts grouped by the address book index as cursor extras. For most languages it is the first letter of the sort key. This parameter does not affect the main content of the cursor.

```kotlin
Example:
 
  import android.provider.ContactsContract.Contacts;
 
  Uri uri = Contacts.CONTENT_URI.buildUpon()
           .appendQueryParameter(Contacts.EXTRA_ADDRESS_BOOK_INDEX, "true")
           .build();
  Cursor cursor = getContentResolver().query(uri,
           new String[] {Contacts.DISPLAY_NAME},
           null, null, null);
  Bundle bundle = cursor.getExtras();
  if (bundle.containsKey(Contacts.EXTRA_ADDRESS_BOOK_INDEX_TITLES) &&
          bundle.containsKey(Contacts.EXTRA_ADDRESS_BOOK_INDEX_COUNTS)) {
      String sections[] =
              bundle.getStringArray(Contacts.EXTRA_ADDRESS_BOOK_INDEX_TITLES);
      int counts[] = bundle.getIntArray(Contacts.EXTRA_ADDRESS_BOOK_INDEX_COUNTS);
  }
  
```

<br />

    Value: "android.provider.extra.ADDRESS_BOOK_INDEX"

### EXTRA_ADDRESS_BOOK_INDEX_COUNTS

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_ADDRESS_BOOK_INDEX_COUNTS: String
```

The array of group counts for the corresponding group. Contains the same number of elements as the EXTRA_ADDRESS_BOOK_INDEX_TITLES array.

TYPE: int\[\]

    Value: "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS"

### EXTRA_ADDRESS_BOOK_INDEX_TITLES

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val EXTRA_ADDRESS_BOOK_INDEX_TITLES: String
```

The array of address book index titles, which are returned in the same order as the data in the cursor.

TYPE: String\[\]

    Value: "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES"

### QUERY_PARAMETER_VCARD_NO_PHOTO

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val QUERY_PARAMETER_VCARD_NO_PHOTO: String
```

Boolean parameter that may be used with `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_VCARD_URI:android.net.Uri` and `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_MULTI_VCARD_URI:android.net.Uri` to indicate that the returned vcard should not contain a photo. This is useful for obtaining a space efficient vcard.

    Value: "no_photo"

## Public methods

### getLookupUri

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open static fun getLookupUri(
    resolver: ContentResolver!, 
    contactUri: Uri!
): Uri!
```

Builds a `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_LOOKUP_URI:android.net.Uri` style `https://developer.android.com/reference/kotlin/android/net/Uri.html#` describing the requested `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#` entry.

| Parameters ||
|---|---|
| `contactUri` | [Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)!: A `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_URI:android.net.Uri` row, or an existing `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_LOOKUP_URI:android.net.Uri` to attempt refreshing. |

### getLookupUri

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open static fun getLookupUri(
    contactId: Long, 
    lookupKey: String!
): Uri!
```

Build a `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_LOOKUP_URI:android.net.Uri` lookup `https://developer.android.com/reference/kotlin/android/net/Uri.html#` using the given `https://developer.android.com/reference/kotlin/android/provider/BaseColumns#_ID:kotlin.String` and `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#LOOKUP_KEY:kotlin.String`.

Returns null if unable to construct a valid lookup URI from the provided parameters.

### isEnterpriseContactId

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open static fun isEnterpriseContactId(contactId: Long): Boolean
```

Return `true` if a contact ID is from the contacts provider on the managed profile. `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.PhoneLookup#ENTERPRISE_CONTENT_FILTER_URI:android.net.Uri` and similar APIs may return such IDs.

### lookupContact

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open static fun lookupContact(
    resolver: ContentResolver!, 
    lookupUri: Uri!
): Uri!
```

Computes a content URI (see `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_URI:android.net.Uri`) given a lookup URI.

Returns null if the contact cannot be found.

### markAsContacted

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open static fun markAsContacted(
    resolver: ContentResolver!, 
    contactId: Long
): Unit
```

**Deprecated:** *Contacts affinity information is no longer supported as of Android version `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#Q:kotlin.Int`. This method is no-op.*

Mark a contact as having been contacted. Updates two fields: `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactOptionsColumns#TIMES_CONTACTED:kotlin.String` and `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactOptionsColumns#LAST_TIME_CONTACTED:kotlin.String`. The TIMES_CONTACTED field is incremented by 1 and the LAST_TIME_CONTACTED field is populated with the current system time.

**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](https://developer.android.com/reference/kotlin/guide/topics/providers/contacts-provider#ObsoleteData) page.

| Parameters ||
|---|---|
| `resolver` | [ContentResolver](https://developer.android.com/reference/kotlin/android/content/ContentResolver.html#)!: the ContentResolver to use |
| `contactId` | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html): the person who was contacted |

### openContactPhotoInputStream

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open static fun openContactPhotoInputStream(
    cr: ContentResolver!, 
    contactUri: Uri!
): InputStream!
```

Opens an InputStream for the contacts's thumbnail photo and returns the photo as a byte stream.

| Parameters ||
|---|---|
| `cr` | [ContentResolver](https://developer.android.com/reference/kotlin/android/content/ContentResolver.html#)!: The content resolver to use for querying |
| `contactUri` | [Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)!: the contact whose photo should be used. This can be used with either a `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_URI:android.net.Uri` or a `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_LOOKUP_URI:android.net.Uri` URI. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/java/io/InputStream.html#!` | an InputStream of the photo, or null if no photo is present |

**See Also**

- `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#openContactPhotoInputStream(android.content.ContentResolver,%20android.net.Uri,%20kotlin.Boolean)`

### openContactPhotoInputStream

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open static fun openContactPhotoInputStream(
    cr: ContentResolver!, 
    contactUri: Uri!, 
    preferHighres: Boolean
): InputStream!
```

Opens an InputStream for the contacts's photo and returns the photo as a byte stream.

| Parameters ||
|---|---|
| `cr` | [ContentResolver](https://developer.android.com/reference/kotlin/android/content/ContentResolver.html#)!: The content resolver to use for querying |
| `contactUri` | [Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)!: the contact whose photo should be used. This can be used with either a `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_URI:android.net.Uri` or a `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_LOOKUP_URI:android.net.Uri` URI. |
| `preferHighres` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): If this is true and the contact has a higher resolution photo available, it is returned. If false, this function always tries to get the thumbnail |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/java/io/InputStream.html#!` | an InputStream of the photo, or null if no photo is present |

## Properties

### CONTENT_FILTER_URI

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val CONTENT_FILTER_URI: Uri!
```

The content:// style URI used for "type-to-filter" functionality on the `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_URI:android.net.Uri` URI. The filter string will be used to match various parts of the contact name. The filter argument should be passed as an additional path segment after this URI.

### CONTENT_FREQUENT_URI

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val CONTENT_FREQUENT_URI: Uri!
```

**Deprecated:** *Frequent contacts are no longer supported as of Android version `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#Q:kotlin.Int`. This URI always returns an empty cursor.*

***Caution:** If you publish your app to the Google Play Store, this field doesn't sort results based on contacts frequency. For more information, see the [Contacts Provider](https://developer.android.com/reference/kotlin/guide/topics/providers/contacts-provider#ObsoleteData) page.*

<br />

The content:// style URI for showing a list of frequently contacted people.

### CONTENT_GROUP_URI

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val CONTENT_GROUP_URI: Uri!
```

### CONTENT_LOOKUP_URI

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val CONTENT_LOOKUP_URI: Uri!
```

A content:// style URI for this table that should be used to create shortcuts or otherwise create long-term links to contacts. This URI should always be followed by a "/" and the contact's `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#LOOKUP_KEY:kotlin.String`. It can optionally also have a "/" and last known contact ID appended after that. This "complete" format is an important optimization and is highly recommended.

As long as the contact's row ID remains the same, this URI is equivalent to `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_URI:android.net.Uri`. If the contact's row ID changes as a result of a sync or aggregation, this URI will look up the contact using indirect information (sync IDs or constituent raw contacts).

Lookup key should be appended unencoded - it is stored in the encoded form, ready for use in a URI.

### CONTENT_MULTI_VCARD_URI

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val CONTENT_MULTI_VCARD_URI: Uri!
```

Base `https://developer.android.com/reference/kotlin/android/net/Uri.html#` for referencing multiple `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#` entry, created by appending `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#LOOKUP_KEY:kotlin.String` using `https://developer.android.com/reference/kotlin/android/net/Uri.html#withAppendedPath(android.net.Uri,%20kotlin.String)`. The lookup keys have to be joined with the colon (":") separator, and the resulting string encoded. Provides `https://developer.android.com/reference/kotlin/android/provider/OpenableColumns` columns when queried, or returns the referenced contact formatted as a vCard when opened through `https://developer.android.com/reference/kotlin/android/content/ContentResolver.html#openAssetFileDescriptor(android.net.Uri,%20kotlin.String)`.

Usage example:

The following code snippet creates a multi-vcard URI that references all the contacts in a user's database.
:

    ```kotlin
    public Uri getAllContactsVcardUri() {
          Cursor cursor = getActivity().getContentResolver().query(Contacts.CONTENT_URI,
              new String[] {Contacts.LOOKUP_KEY}, null, null, null);
          if (cursor == null) {
              return null;
          }
          try {
              StringBuilder uriListBuilder = new StringBuilder();
              int index = 0;
              while (cursor.moveToNext()) {
                  if (index != 0) uriListBuilder.append(':');
                  uriListBuilder.append(cursor.getString(0));
                  index++;
              }
              return Uri.withAppendedPath(Contacts.CONTENT_MULTI_VCARD_URI,
                      Uri.encode(uriListBuilder.toString()));
          } finally {
              cursor.close();
          }
      }
      
    ```


    <br />


### CONTENT_STREQUENT_FILTER_URI

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val CONTENT_STREQUENT_FILTER_URI: Uri!
```

The content:// style URI used for "type-to-filter" functionality on the `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_STREQUENT_URI:android.net.Uri` URI. The filter string will be used to match various parts of the contact name. The filter argument should be passed as an additional path segment after this URI.

**Caution:** If you publish your app to the Google Play Store, this field doesn't sort results based on contacts frequency. For more information, see the [Contacts Provider](https://developer.android.com/reference/kotlin/guide/topics/providers/contacts-provider#ObsoleteData) page.

### CONTENT_STREQUENT_URI

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val CONTENT_STREQUENT_URI: Uri!
```

The content:// style URI for this table joined with useful data from `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Data`, filtered to include only starred contacts. Frequent contacts are no longer included in the result as of Android version `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#Q:kotlin.Int`.

**Caution:** If you publish your app to the Google Play Store, this field doesn't sort results based on contacts frequency. For more information, see the [Contacts Provider](https://developer.android.com/reference/kotlin/guide/topics/providers/contacts-provider#ObsoleteData) page.

### CONTENT_URI

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val CONTENT_URI: Uri!
```

The content:// style URI for this table

### CONTENT_VCARD_URI

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val CONTENT_VCARD_URI: Uri!
```

Base `https://developer.android.com/reference/kotlin/android/net/Uri.html#` for referencing a single `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#` entry, created by appending `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#LOOKUP_KEY:kotlin.String` using `https://developer.android.com/reference/kotlin/android/net/Uri.html#withAppendedPath(android.net.Uri,%20kotlin.String)`. Provides `https://developer.android.com/reference/kotlin/android/provider/OpenableColumns` columns when queried, or returns the referenced contact formatted as a vCard when opened through `https://developer.android.com/reference/kotlin/android/content/ContentResolver.html#openAssetFileDescriptor(android.net.Uri,%20kotlin.String)`.

### ENTERPRISE_CONTENT_FILTER_URI

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val ENTERPRISE_CONTENT_FILTER_URI: Uri!
```

It supports the similar semantics as `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_FILTER_URI:android.net.Uri` and returns the same columns. This URI requires `https://developer.android.com/reference/kotlin/android/provider/ContactsContract#DIRECTORY_PARAM_KEY:kotlin.String` in parameters, otherwise it will throw IllegalArgumentException. The passed directory can belong either to the calling user or to a managed profile that is linked to it.

### ENTERPRISE_CONTENT_URI

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val ENTERPRISE_CONTENT_URI: Uri
```

URI used for getting all contacts from both the calling user and the managed profile that is linked to it.

It supports the same semantics as `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_URI:android.net.Uri` and returns the same columns.  
If the calling user has no managed profile, it behaves in the exact same way as `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_URI:android.net.Uri`.  
If there is a managed profile linked to the calling user, it will return merged results from both.

Note: this query returns the calling user results before the managed profile results, and this order is not affected by the sorting parameter.

If a result is from the managed profile, the following changes are made to the data:

- `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#PHOTO_THUMBNAIL_URI:kotlin.String` and `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#PHOTO_URI:kotlin.String` will be rewritten to special URIs. Use android.content.ContentResolver#openAssetFileDescriptor or its siblings to load pictures from them.
- `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#PHOTO_ID:kotlin.String` and `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#PHOTO_FILE_ID:kotlin.String` will be set to null. Don't use them.
- `https://developer.android.com/reference/kotlin/android/provider/BaseColumns#_ID:kotlin.String` and `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.ContactsColumns#LOOKUP_KEY:kotlin.String` will be replaced with artificial values. These values will be consistent across multiple queries, but do not use them in places that do not explicitly say they accept them. If they are used in the `selection` param in android.content.ContentProvider#query, the result is undefined.
- In order to tell whether a contact is from the managed profile, use `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#isEnterpriseContactId(kotlin.Long)`.