# Print output for @column tags ?> ContactsContract.PhoneLookup - Android SDK | Android Developers

Most visited

Recently visited

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 the "enterprise caller-id".

Inherited methods

Constants

QUERY_PARAMETER_SIP_ADDRESS

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

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

public static final Uri ENTERPRISE_CONTENT_FILTER_URI

URI used for the "enterprise caller-id".

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.

It supports the same semantics as CONTENT_FILTER_URI and returns the same columns. If the device has no corp profile that is linked to the current profile, it behaves in the exact same way as CONTENT_FILTER_URI. If there is a corp profile linked to the current profile, it first queries against the personal contact database, and if no matching contacts are found there, then queries against the corp contacts database.

If a result is from the corp profile, it makes the following changes to the data:

A contact lookup URL built by ContactsContract.Contacts#getLookupUri(long, String) with an BaseColumns._ID and a ContactsContract.ContactsColumns.LOOKUP_KEY returned by this API can be passed to ContactsContract.QuickContact#showQuickContact even if a contact is from the corp profile.

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