Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Constants](https://developer.android.com/reference/android/provider/ContactsContract.PhoneLookup#constants) \| [Inherited Constants](https://developer.android.com/reference/android/provider/ContactsContract.PhoneLookup#inhconstants) \| [Fields](https://developer.android.com/reference/android/provider/ContactsContract.PhoneLookup#lfields) \| [Inherited Methods](https://developer.android.com/reference/android/provider/ContactsContract.PhoneLookup#inhmethods)

# ContactsContract.PhoneLookup

*** ** * ** ***

` public static final class ContactsContract.PhoneLookup `   
` extends https://developer.android.com/reference/java/lang/Object ` ` implements https://developer.android.com/reference/android/provider/BaseColumns, https://developer.android.com/reference/android/provider/ContactsContract.ContactNameColumns, https://developer.android.com/reference/android/provider/ContactsContract.ContactOptionsColumns, https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns, https://developer.android.com/reference/android/provider/ContactsContract.PhoneLookupColumns `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.provider.ContactsContract.PhoneLookup |

<br />

*** ** * ** ***

A table that represents the result of looking up a phone number, for example for caller ID. To perform a lookup you must append the number you want to find to `https://developer.android.com/reference/android/provider/ContactsContract.PhoneLookup#CONTENT_FILTER_URI`. This query is highly optimized.

```
Uri uri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(phoneNumber));
resolver.query(uri, new String[]{PhoneLookup.DISPLAY_NAME,...
```

### Columns

| PhoneLookup ||||
|---|---|---|---|
| String | `https://developer.android.com/reference/android/provider/ContactsContract.PhoneLookupColumns#NUMBER` | read-only | Phone number. |
| String | `https://developer.android.com/reference/android/provider/ContactsContract.PhoneLookupColumns#TYPE` | read-only | Phone number type. See `https://developer.android.com/reference/android/provider/ContactsContract.CommonDataKinds.Phone`. |
| String | `https://developer.android.com/reference/android/provider/ContactsContract.PhoneLookupColumns#LABEL` | read-only | Custom label for the phone number. See `https://developer.android.com/reference/android/provider/ContactsContract.CommonDataKinds.Phone`. |

Columns from the Contacts table are also available through a join.

| Join with `https://developer.android.com/reference/android/provider/ContactsContract.Contacts` ||||
|---|---|---|---|
| long | `https://developer.android.com/reference/android/provider/BaseColumns#_ID` | read-only | Contact ID. |
| long | `https://developer.android.com/reference/android/provider/ContactsContract.PhoneLookupColumns#CONTACT_ID` | read-only | Contact ID. |
| long | `https://developer.android.com/reference/android/provider/ContactsContract.PhoneLookupColumns#DATA_ID` | read-only | Data ID. |
| String | `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#LOOKUP_KEY` | read-only | See `https://developer.android.com/reference/android/provider/ContactsContract.Contacts` |
| String | `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#DISPLAY_NAME` | read-only | See `https://developer.android.com/reference/android/provider/ContactsContract.Contacts` |
| long | `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#PHOTO_ID` | read-only | See `https://developer.android.com/reference/android/provider/ContactsContract.Contacts`. |
| int | `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#IN_VISIBLE_GROUP` | read-only | See `https://developer.android.com/reference/android/provider/ContactsContract.Contacts`. |
| int | `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#HAS_PHONE_NUMBER` | read-only | See `https://developer.android.com/reference/android/provider/ContactsContract.Contacts`. |
| int | `https://developer.android.com/reference/android/provider/ContactsContract.ContactOptionsColumns#STARRED` | read-only | See `https://developer.android.com/reference/android/provider/ContactsContract.Contacts`. |
| String | `https://developer.android.com/reference/android/provider/ContactsContract.ContactOptionsColumns#CUSTOM_RINGTONE` | read-only | See `https://developer.android.com/reference/android/provider/ContactsContract.Contacts`. |
| int | `https://developer.android.com/reference/android/provider/ContactsContract.ContactOptionsColumns#SEND_TO_VOICEMAIL` | read-only | See `https://developer.android.com/reference/android/provider/ContactsContract.Contacts`. |

<br />

## Summary

| ### Constants ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/provider/ContactsContract.PhoneLookup#QUERY_PARAMETER_SIP_ADDRESS` If this boolean parameter is set to true, then the appended query is treated as a SIP address and the lookup will be performed against SIP addresses in the user's contacts. |

### Inherited constants

From interface `https://developer.android.com/reference/android/provider/BaseColumns` `https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/BaseColumns#_COUNT`

The count of rows in a directory.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/BaseColumns#_ID`

The unique ID for a row.
From interface `https://developer.android.com/reference/android/provider/ContactsContract.ContactNameColumns` `https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactNameColumns#DISPLAY_NAME_ALTERNATIVE`

<br />

An alternative representation of the display name, such as "family name first" instead of "given name first" for Western names.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactNameColumns#DISPLAY_NAME_PRIMARY`

<br />

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

The kind of data that is used as the display name for the contact, such as structured name or email address.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactNameColumns#PHONETIC_NAME`

<br />

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

The phonetic alphabet used to represent the `https://developer.android.com/reference/android/provider/ContactsContract.ContactNameColumns#PHONETIC_NAME`.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactNameColumns#SORT_KEY_ALTERNATIVE`

Sort key based on the alternative representation of the full name, `https://developer.android.com/reference/android/provider/ContactsContract.ContactNameColumns#DISPLAY_NAME_ALTERNATIVE`.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactNameColumns#SORT_KEY_PRIMARY`

Sort key that takes into account locale-based traditions for sorting names in address books.
From interface `https://developer.android.com/reference/android/provider/ContactsContract.ContactOptionsColumns` `https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactOptionsColumns#CUSTOM_RINGTONE`

URI for a custom ringtone associated with the contact.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactOptionsColumns#LAST_TIME_CONTACTED`

*This constant was deprecated in API level 29. Contacts affinity information is no longer supported as of Android version `https://developer.android.com/reference/android/os/Build.VERSION_CODES#Q`. This column always contains 0.*
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactOptionsColumns#PINNED`

The position at which the contact is pinned.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactOptionsColumns#SEND_TO_VOICEMAIL`

Whether the contact should always be sent to voicemail.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactOptionsColumns#STARRED`

Is the contact starred?

Type: INTEGER (boolean)

<br />

`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactOptionsColumns#TIMES_CONTACTED`

*This constant was deprecated in API level 29. Contacts affinity information is no longer supported as of Android version `https://developer.android.com/reference/android/os/Build.VERSION_CODES#Q`. This column always contains 0.*
From interface `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns` `https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#CONTACT_LAST_UPDATED_TIMESTAMP`

Timestamp (milliseconds since epoch) of when this contact was last updated.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#DISPLAY_NAME`

The display name for the contact.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#HAS_PHONE_NUMBER`

An indicator of whether this contact has at least one phone number.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#IN_DEFAULT_DIRECTORY`

Flag that reflects whether the contact exists inside the default directory.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#IN_VISIBLE_GROUP`

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

Flag that reflects whether this contact represents the user's personal profile entry.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#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.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#NAME_RAW_CONTACT_ID`

Reference to the row in the RawContacts table holding the contact name.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#PHOTO_FILE_ID`

Photo file ID of the full-size photo.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#PHOTO_ID`

Reference to the row in the data table holding the photo.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#PHOTO_THUMBNAIL_URI`

A URI that can be used to retrieve a thumbnail of the contact's photo.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#PHOTO_URI`

A URI that can be used to retrieve the contact's full-size photo.
From interface `https://developer.android.com/reference/android/provider/ContactsContract.PhoneLookupColumns` `https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.PhoneLookupColumns#CONTACT_ID`

A reference to the `https://developer.android.com/reference/android/provider/BaseColumns#_ID` that this data belongs to.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.PhoneLookupColumns#DATA_ID`

The ID of the data row.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.PhoneLookupColumns#LABEL`

The user defined label for the phone number.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.PhoneLookupColumns#NORMALIZED_NUMBER`

The phone number's E164 representation.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.PhoneLookupColumns#NUMBER`

The phone number as the user entered it.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.PhoneLookupColumns#TYPE`

The type of phone number, for example Home or Work.

| ### Fields ||
|---|---|
| ` public static final https://developer.android.com/reference/android/net/Uri` | `https://developer.android.com/reference/android/provider/ContactsContract.PhoneLookup#CONTENT_FILTER_URI` The content:// style URI for this table. |
| ` public static final https://developer.android.com/reference/android/net/Uri` | `https://developer.android.com/reference/android/provider/ContactsContract.PhoneLookup#ENTERPRISE_CONTENT_FILTER_URI` URI used for looking up contacts by phone number on the contact databases of both the calling user and the managed profile that is linked to it. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Constants

### QUERY_PARAMETER_SIP_ADDRESS

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

```
public static final String QUERY_PARAMETER_SIP_ADDRESS
```

If this boolean parameter is set to true, then the appended query is treated as a SIP address and the lookup will be performed against SIP addresses in the user's contacts.

<br />

Constant Value: "sip"

## Fields

### CONTENT_FILTER_URI

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

```
public static final Uri CONTENT_FILTER_URI
```

The content:// style URI for this table.

**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/guide/topics/providers/contacts-provider#ObsoleteData) page. Append the phone number you want to lookup to this URI and query it to perform a lookup. For example:

```
Uri lookupUri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI,
        Uri.encode(phoneNumber));
```

<br />

<br />

### ENTERPRISE_CONTENT_FILTER_URI

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

```
public static final Uri ENTERPRISE_CONTENT_FILTER_URI
```

URI used for looking up contacts by phone number on the contact databases of both the calling user and the managed profile that is linked to it.

It supports the same semantics as `https://developer.android.com/reference/android/provider/ContactsContract.PhoneLookup#CONTENT_FILTER_URI` and returns the same columns.  

If the device has no managed profile that is linked to the calling user, it behaves in the exact same way as `https://developer.android.com/reference/android/provider/ContactsContract.PhoneLookup#CONTENT_FILTER_URI`.  

If there is a managed profile linked to the calling user, it first queries the calling user's contact database, and only if no matching contacts are found there it then queries the managed profile database.

**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/guide/topics/providers/contacts-provider#ObsoleteData) page.

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

- `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#PHOTO_THUMBNAIL_URI` and `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#PHOTO_URI` will be rewritten to special URIs. Use `https://developer.android.com/reference/android/content/ContentResolver#openAssetFileDescriptor(android.net.Uri,%20java.lang.String)` or its siblings to load pictures from them.
- `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#PHOTO_ID` and `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#PHOTO_FILE_ID` will be set to null. Don't use them.
- `https://developer.android.com/reference/android/provider/ContactsContract.PhoneLookupColumns#CONTACT_ID` and `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#LOOKUP_KEY` 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 `https://developer.android.com/reference/android/content/ContentProvider#query(android.net.Uri,%20java.lang.String[],%20android.os.Bundle,%20android.os.CancellationSignal)`, the result is undefined.
- In order to tell whether a contact is from the managed profile, use `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#isEnterpriseContactId(long)`.

  A contact lookup URL built by `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#getLookupUri(long,%20java.lang.String)` with a `https://developer.android.com/reference/android/provider/ContactsContract.PhoneLookupColumns#CONTACT_ID` and a `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#LOOKUP_KEY` returned by this API can be passed to `https://developer.android.com/reference/android/provider/ContactsContract.QuickContact#showQuickContact(android.content.Context,%20android.graphics.Rect,%20android.net.Uri,%20int,%20java.lang.String[])` even if a contact is from the managed profile.

  ```
  Uri lookupUri = Uri.withAppendedPath(PhoneLookup.ENTERPRISE_CONTENT_FILTER_URI,
          Uri.encode(phoneNumber));

      
  ```