Most visited

Recently visited

Added in API level 5

ContactsContract

public final class ContactsContract
extends Object

java.lang.Object
   ↳ android.provider.ContactsContract


The contract between the contacts provider and applications. Contains definitions for the supported URIs and columns. These APIs supersede ContactsContract.Contacts.

Overview

ContactsContract defines an extensible database of contact-related information. Contact information is stored in a three-tier data model:

Other tables include:

Summary

Nested classes

class ContactsContract.AggregationExceptions

Constants for the contact aggregation exceptions table, which contains aggregation rules overriding those used by automatic aggregation. 

interface ContactsContract.BaseSyncColumns

Generic columns for use by sync adapters. 

class ContactsContract.CommonDataKinds

Container for definitions of common data types stored in the ContactsContract.Data table. 

interface ContactsContract.ContactNameColumns

Contact name and contact name metadata columns in the RawContacts table. 

interface ContactsContract.ContactOptionsColumns

Columns of ContactsContract.Contacts that track the user's preferences for, or interactions with, the contact. 

interface ContactsContract.ContactStatusColumns

 

class ContactsContract.Contacts

Constants for the contacts table, which contains a record per aggregate of raw contacts representing the same person. 

interface ContactsContract.ContactsColumns

Columns of ContactsContract.Contacts that refer to intrinsic properties of the contact, as opposed to the user-specified options found in ContactsContract.ContactOptionsColumns

class ContactsContract.Data

Constants for the data table, which contains data points tied to a raw contact. 

interface ContactsContract.DataColumns

Columns in the Data table. 

interface ContactsContract.DataColumnsWithJoins

Combines all columns returned by ContactsContract.Data table queries. 

class ContactsContract.DataUsageFeedback

API allowing applications to send usage information for each ContactsContract.Contacts.Data row to the Contacts Provider. 

interface ContactsContract.DataUsageStatColumns

Columns in the Data_Usage_Stat table  

class ContactsContract.DeletedContacts

Constants for the deleted contact table. 

interface ContactsContract.DeletedContactsColumns

 

class ContactsContract.Directory

A Directory represents a contacts corpus, e.g. 

interface ContactsContract.DisplayNameSources

Types of data used to produce the display name for a contact. 

class ContactsContract.DisplayPhoto

Helper class for accessing full-size photos by photo file ID. 

interface ContactsContract.FullNameStyle

Constants for various styles of combining given name, family name etc into a full name. 

class ContactsContract.Groups

Constants for the groups table. 

interface ContactsContract.GroupsColumns

 

class ContactsContract.Intents

Contains helper classes used to create or manage Intents that involve contacts. 

class ContactsContract.PhoneLookup

A table that represents the result of looking up a phone number, for example for caller ID. 

interface ContactsContract.PhoneLookupColumns

 

interface ContactsContract.PhoneticNameStyle

Constants for various styles of capturing the pronunciation of a person's name. 

class ContactsContract.PinnedPositions

Contact-specific information about whether or not a contact has been pinned by the user at a particular position within the system contact application's user interface. 

class ContactsContract.Presence

This class was deprecated in API level 5. This old name was never meant to be made public. Do not use.  

interface ContactsContract.PresenceColumns

Additional data mixed in with ContactsContract.StatusColumns to link back to specific _ID entries. 

class ContactsContract.Profile

Constants for the user's profile data, which is represented as a single contact on the device that represents the user. 

class ContactsContract.ProfileSyncState

A table provided for sync adapters to use for storing private sync state data for the user's personal profile. 

class ContactsContract.ProviderStatus

API for inquiring about the general status of the provider. 

class ContactsContract.QuickContact

Helper methods to display QuickContact dialogs that display all the information belonging to a specific Contacts entry. 

class ContactsContract.RawContacts

Constants for the raw contacts table, which contains one row of contact information for each person in each synced account. 

interface ContactsContract.RawContactsColumns

 

class ContactsContract.RawContactsEntity

Constants for the raw contacts entities table, which can be thought of as an outer join of the raw_contacts table with the data table. 

class ContactsContract.SearchSnippets

Additional column returned by Contacts.CONTENT_FILTER_URI explaining why the filter matched the contact. 

class ContactsContract.Settings

Contacts-specific settings for various Account's. 

interface ContactsContract.SettingsColumns

 

interface ContactsContract.StatusColumns

Social status update columns. 

class ContactsContract.StatusUpdates

A status update is linked to a ContactsContract.Data row and captures the user's latest status update via the corresponding source, e.g. 

interface ContactsContract.SyncColumns

Columns that appear when each row of a table belongs to a specific account, including sync information that an account may need. 

class ContactsContract.SyncState

A table provided for sync adapters to use for storing private sync state data for contacts. 

Constants

String AUTHORITY

The authority for the contacts provider

String CALLER_IS_SYNCADAPTER

An optional URI parameter for insert, update, or delete queries that allows the caller to specify that it is a sync adapter.

String DEFERRED_SNIPPETING

A key to a boolean in the "extras" bundle of the cursor.

String DEFERRED_SNIPPETING_QUERY

Key to retrieve the original deferred snippeting from the cursor on the client side.

String DIRECTORY_PARAM_KEY

Query parameter that should be used by the client to access a specific ContactsContract.Directory.

String LIMIT_PARAM_KEY

A query parameter that limits the number of results returned.

String PRIMARY_ACCOUNT_NAME

A query parameter specifing a primary account.

String PRIMARY_ACCOUNT_TYPE

A query parameter specifing a primary account.

String REMOVE_DUPLICATE_ENTRIES

A boolean parameter for Phone.CONTENT_URI, Email.CONTENT_URI, and StructuredPostal.CONTENT_URI.

String STREQUENT_PHONE_ONLY

A boolean parameter for CONTENT_STREQUENT_URI and CONTENT_STREQUENT_FILTER_URI, which requires the ContactsProvider to return only phone-related results.

Fields

public static final Uri AUTHORITY_URI

A content:// style uri to the authority for the contacts provider

Public constructors

ContactsContract()

Public methods

static boolean isProfileId(long id)

This method can be used to identify whether the given ID is associated with profile data.

Inherited methods

From class java.lang.Object

Constants

AUTHORITY

Added in API level 5
String AUTHORITY

The authority for the contacts provider

Constant Value: "com.android.contacts"

CALLER_IS_SYNCADAPTER

Added in API level 5
String CALLER_IS_SYNCADAPTER

An optional URI parameter for insert, update, or delete queries that allows the caller to specify that it is a sync adapter. The default value is false. If true DIRTY is not automatically set and the "syncToNetwork" parameter is set to false when calling notifyChange(android.net.Uri, android.database.ContentObserver, boolean). This prevents an unnecessary extra synchronization, see the discussion of the delete operation in ContactsContract.RawContacts.

Constant Value: "caller_is_syncadapter"

DEFERRED_SNIPPETING

Added in API level 21
String DEFERRED_SNIPPETING

A key to a boolean in the "extras" bundle of the cursor. The boolean indicates that the provider did not create a snippet and that the client asking for the snippet should do it (true means the snippeting was deferred to the client).

See also:

Constant Value: "deferred_snippeting"

DEFERRED_SNIPPETING_QUERY

Added in API level 21
String DEFERRED_SNIPPETING_QUERY

Key to retrieve the original deferred snippeting from the cursor on the client side.

See also:

Constant Value: "deferred_snippeting_query"

DIRECTORY_PARAM_KEY

Added in API level 11
String DIRECTORY_PARAM_KEY

Query parameter that should be used by the client to access a specific ContactsContract.Directory. The parameter value should be the _ID of the corresponding directory, e.g. content://com.android.contacts/data/emails/filter/acme?directory=3

Constant Value: "directory"

LIMIT_PARAM_KEY

Added in API level 11
String LIMIT_PARAM_KEY

A query parameter that limits the number of results returned. The parameter value should be an integer.

Constant Value: "limit"

PRIMARY_ACCOUNT_NAME

Added in API level 14
String PRIMARY_ACCOUNT_NAME

A query parameter specifing a primary account. This parameter should be used with PRIMARY_ACCOUNT_TYPE. The contacts provider handling a query may rely on this information to optimize its query results. For example, in an email composition screen, its implementation can specify an account when obtaining possible recipients, letting the provider know which account is selected during the composition. The provider may use the "primary account" information to optimize the search result.

Constant Value: "name_for_primary_account"

PRIMARY_ACCOUNT_TYPE

Added in API level 14
String PRIMARY_ACCOUNT_TYPE

A query parameter specifing a primary account. This parameter should be used with PRIMARY_ACCOUNT_NAME. See the doc in PRIMARY_ACCOUNT_NAME.

Constant Value: "type_for_primary_account"

REMOVE_DUPLICATE_ENTRIES

Added in API level 21
String REMOVE_DUPLICATE_ENTRIES

A boolean parameter for Phone.CONTENT_URI, Email.CONTENT_URI, and StructuredPostal.CONTENT_URI. This enables a content provider to remove duplicate entries in results.

Constant Value: "remove_duplicate_entries"

STREQUENT_PHONE_ONLY

Added in API level 21
String STREQUENT_PHONE_ONLY

A boolean parameter for CONTENT_STREQUENT_URI and CONTENT_STREQUENT_FILTER_URI, which requires the ContactsProvider to return only phone-related results. For example, frequently contacted person list should include persons contacted via phone (not email, sms, etc.)

Constant Value: "strequent_phone_only"

Fields

AUTHORITY_URI

Added in API level 5
Uri AUTHORITY_URI

A content:// style uri to the authority for the contacts provider

Public constructors

ContactsContract

Added in API level 5
ContactsContract ()

Public methods

isProfileId

Added in API level 14
boolean isProfileId (long id)

This method can be used to identify whether the given ID is associated with profile data. It does not necessarily indicate that the ID is tied to valid data, merely that accessing data using this ID will result in profile access checks and will only return data from the profile.

Parameters
id long: The ID to check.
Returns
boolean Whether the ID is associated with profile data.

Hooray!