ContactsContract.PhoneLookup

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

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.

Join with Contacts
long BaseColumns._ID read-only Contact ID.
long ContactsContract.PhoneLookupColumns.CONTACT_ID read-only Contact ID.
long ContactsContract.PhoneLookupColumns.DATA_ID read-only Data ID.
String ContactsContract.ContactsColumns.LOOKUP_KEY read-only See ContactsContract.Contacts
String ContactsContract.ContactsColumns.DISPLAY_NAME read-only See ContactsContract.Contacts
long ContactsContract.ContactsColumns.PHOTO_ID read-only See ContactsContract.Contacts.
int ContactsContract.ContactsColumns.IN_VISIBLE_GROUP read-only See ContactsContract.Contacts.
int ContactsContract.ContactsColumns.HAS_PHONE_NUMBER read-only See ContactsContract.Contacts.
int ContactsContract.ContactOptionsColumns.STARRED read-only See ContactsContract.Contacts.
String ContactsContract.ContactOptionsColumns.CUSTOM_RINGTONE read-only See ContactsContract.Contacts.
int ContactsContract.ContactOptionsColumns.SEND_TO_VOICEMAIL read-only See ContactsContract.Contacts.

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

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

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: