ContactsContract.PhoneLookup


public static final class ContactsContract.PhoneLookup
extends Object implements BaseColumns, ContactsContract.ContactNameColumns, ContactsContract.ContactOptionsColumns, ContactsContract.ContactsColumns, ContactsContract.PhoneLookupColumns

java.lang.Object
   ↳ android.provider.ContactsContract.PhoneLookup


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 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 ContactsContract.PhoneLookupColumns.NUMBER read-only Phone number.
String ContactsContract.PhoneLookupColumns.TYPE read-only Phone number type. See CommonDataKinds.Phone.
String ContactsContract.PhoneLookupColumns.LABEL read-only Custom label for the phone number. See CommonDataKinds.Phone.

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

Summary

Constants

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.

Inherited constants

String _COUNT

The count of rows in a directory.

String _ID

The unique ID for a row.

String DISPLAY_NAME_ALTERNATIVE

An alternative representation of the display name, such as "family name first" instead of "given name first" for Western names.

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).

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.

String PHONETIC_NAME

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

String PHONETIC_NAME_STYLE

The phonetic alphabet used to represent the PHONETIC_NAME.

String SORT_KEY_ALTERNATIVE

Sort key based on the alternative representation of the full name, DISPLAY_NAME_ALTERNATIVE.

String SORT_KEY_PRIMARY

Sort key that takes into account locale-based traditions for sorting names in address books.

String CUSTOM_RINGTONE

URI for a custom ringtone associated with the contact.

String LAST_TIME_CONTACTED

This constant was deprecated in API level 29. Contacts affinity information is no longer supported as of Android version Build.VERSION_CODES.Q. This column always contains 0.

String PINNED

The position at which the contact is pinned.

String SEND_TO_VOICEMAIL

Whether the contact should always be sent to voicemail.

String STARRED

Is the contact starred?

Type: INTEGER (boolean)

String TIMES_CONTACTED

This constant was deprecated in API level 29. Contacts affinity information is no longer supported as of Android version Build.VERSION_CODES.Q. This column always contains 0.

String CONTACT_LAST_UPDATED_TIMESTAMP

Timestamp (milliseconds since epoch) of when this contact was last updated.

String DISPLAY_NAME

The display name for the contact.

String HAS_PHONE_NUMBER

An indicator of whether this contact has at least one phone number.

String IN_DEFAULT_DIRECTORY

Flag that reflects whether the contact exists inside the default directory.

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.

String PHOTO_FILE_ID

Photo file ID of the full-size photo.

String PHOTO_ID

Reference to the row in the data table holding the photo.

String PHOTO_THUMBNAIL_URI

A URI that can be used to retrieve a thumbnail of the contact's photo.

String PHOTO_URI

A URI that can be used to retrieve the contact's full-size photo.

String CONTACT_ID

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

String DATA_ID

The ID of the data row.

String LABEL

The user defined label for the phone number.

String NORMALIZED_NUMBER

The phone number's E164 representation.

String NUMBER

The phone number as the user entered it.

String TYPE

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

Fields

public static final Uri CONTENT_FILTER_URI

The content:// style URI for this table.

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.

Inherited methods

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(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 wait(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 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
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.

Constant Value: "sip"

Fields

CONTENT_FILTER_URI

Added in API level 5
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 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));
 

ENTERPRISE_CONTENT_FILTER_URI

Added in API level 21
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 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 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 page.

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