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 ContactsContract.CommonDataKinds.Phone.
String ContactsContract.PhoneLookupColumns.LABEL read-only Custom label for the phone number. See ContactsContract.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.TIMES_CONTACTED read-only See ContactsContract.Contacts.
long ContactsContract.ContactOptionsColumns.LAST_TIME_CONTACTED 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

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

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(Context, Rect, Uri, int, String[]) even if a contact is from the corp profile.

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