Most visited

Recently visited

Added in API level 5

ContactsContract.PhoneLookup

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

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 NUMBER read-only Phone number.
String TYPE read-only Phone number type. See ContactsContract.CommonDataKinds.Phone.
String 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 _ID read-only Contact ID.
long CONTACT_ID read-only Contact ID.
long DATA_ID read-only Data ID.
String LOOKUP_KEY read-only See ContactsContract.Contacts
String DISPLAY_NAME read-only See ContactsContract.Contacts
long PHOTO_ID read-only See ContactsContract.Contacts.
int IN_VISIBLE_GROUP read-only See ContactsContract.Contacts.
int HAS_PHONE_NUMBER read-only See ContactsContract.Contacts.
int TIMES_CONTACTED read-only See ContactsContract.Contacts.
long LAST_TIME_CONTACTED read-only See ContactsContract.Contacts.
int STARRED read-only See ContactsContract.Contacts.
String CUSTOM_RINGTONE read-only See ContactsContract.Contacts.
int 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

From interface android.provider.BaseColumns
From interface android.provider.ContactsContract.PhoneLookupColumns
From interface android.provider.ContactsContract.ContactsColumns
From interface android.provider.ContactsContract.ContactOptionsColumns

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

From class java.lang.Object

Constants

QUERY_PARAMETER_SIP_ADDRESS

Added in API level 21
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
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
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 getLookupUri(long, String) with an _ID and a LOOKUP_KEY returned by this API can be passed to 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));
 

Hooray!