PhoneLookup
class PhoneLookup : BaseColumns, ContactsContract.ContactNameColumns, ContactsContract.ContactOptionsColumns, ContactsContract.ContactsColumns, ContactsContract.PhoneLookupColumns
kotlin.Any | |
↳ | 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 CommonDataKinds.Phone . |
String | 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 | _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 | 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 | |
---|---|
static String |
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 | |
---|---|
Properties | |
---|---|
static Uri! |
The content:// style URI for this table. |
static 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. |
Constants
QUERY_PARAMETER_SIP_ADDRESS
static val QUERY_PARAMETER_SIP_ADDRESS: String
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.
Value: "sip"
Properties
CONTENT_FILTER_URI
static val CONTENT_FILTER_URI: 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
static val ENTERPRISE_CONTENT_FILTER_URI: 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:
PHOTO_THUMBNAIL_URI
andPHOTO_URI
will be rewritten to special URIs. Use android.content.ContentResolver#openAssetFileDescriptor or its siblings to load pictures from them.PHOTO_ID
andPHOTO_FILE_ID
will be set to null. Don't use them.CONTACT_ID
andLOOKUP_KEY
will be replaced with artificial values. These values will be consistent across multiple queries, but do not use them in places that do not explicitly say they accept them. If they are used in theselection
param in android.content.ContentProvider#query, the result is undefined.- In order to tell whether a contact is from the managed profile, use
ContactsContract.Contacts.isEnterpriseContactId(long)
.A contact lookup URL built by
ContactsContract.Contacts.getLookupUri(long, String)
with aCONTACT_ID
and aLOOKUP_KEY
returned by this API can be passed to android.provider.ContactsContract.QuickContact#showQuickContact even if a contact is from the managed profile.Uri lookupUri = Uri.withAppendedPath(PhoneLookup.ENTERPRISE_CONTENT_FILTER_URI, Uri.encode(phoneNumber));