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
 Contacts.
 
Overview
ContactsContract defines an extensible database of contact-related information. Contact information is stored in a three-tier data model:
- 
 A row in the Datatable can store any kind of personal data, such as a phone number or email addresses. The set of data kinds that can be stored in this table is open-ended. There is a predefined set of common kinds, but any application can add its own data kinds.
- 
 A row in the RawContactstable represents a set of data describing a person and associated with a single account (for example, one of the user's Gmail accounts).
- 
 A row in the Contactstable represents an aggregate of one or more RawContacts presumably describing the same person. When data in or associated with the RawContacts table is changed, the affected aggregate contacts are updated as necessary.
Other tables include:
- 
 Groups, which contains information about raw contact groups such as Gmail contact groups. The current API does not support the notion of groups spanning multiple accounts.
- 
 StatusUpdates, which contains social status updates including IM availability.
- 
 AggregationExceptions, which is used for manual aggregation and disaggregation of raw contacts
- 
 Settings, which contains visibility and sync settings for accounts and groups.
- 
 SyncState, which contains free-form data maintained on behalf of sync adapters
- 
 PhoneLookup, which is used for quick caller-ID lookup
Summary
| Nested classes | |
|---|---|
| 
        
        
        
        
        class | ContactsContract.AggregationExceptionsConstants for the contact aggregation exceptions table, which contains aggregation rules overriding those used by automatic aggregation. | 
| 
        
        
        
        
        interface | ContactsContract.BaseSyncColumnsGeneric columns for use by sync adapters. | 
| 
        
        
        
        
        class | ContactsContract.CommonDataKindsContainer for definitions of common data types stored in the  | 
| 
        
        
        
        
        interface | ContactsContract.ContactNameColumnsContact name and contact name metadata columns in the RawContacts table. | 
| 
        
        
        
        
        interface | ContactsContract.ContactOptionsColumnsColumns of  | 
| 
        
        
        
        
        interface | ContactsContract.ContactStatusColumns
 | 
| 
        
        
        
        
        class | ContactsContract.ContactsConstants for the contacts table, which contains a record per aggregate of raw contacts representing the same person. | 
| 
        
        
        
        
        interface | ContactsContract.ContactsColumnsColumns of  | 
| 
        
        
        
        
        class | ContactsContract.DataConstants for the data table, which contains data points tied to a raw contact. | 
| 
        
        
        
        
        interface | ContactsContract.DataColumnsColumns in the Data table. | 
| 
        
        
        
        
        interface | ContactsContract.DataColumnsWithJoinsCombines all columns returned by  | 
| 
        
        
        
        
        class | ContactsContract.DataUsageFeedback
      This class was deprecated
      in API level 29.
    Contacts affinity information is no longer supported as of
 Android version  | 
| 
        
        
        
        
        interface | ContactsContract.DataUsageStatColumnsColumns in the Data_Usage_Stat table | 
| 
        
        
        
        
        class | ContactsContract.DeletedContactsConstants for the deleted contact table. | 
| 
        
        
        
        
        interface | ContactsContract.DeletedContactsColumns
 | 
| 
        
        
        
        
        class | ContactsContract.DirectoryA Directory represents a contacts corpus, e.g. Local contacts, Google Apps Global Address List or Corporate Global Address List. | 
| 
        
        
        
        
        interface | ContactsContract.DisplayNameSourcesTypes of data used to produce the display name for a contact. | 
| 
        
        
        
        
        class | ContactsContract.DisplayPhotoHelper class for accessing full-size photos by photo file ID. | 
| 
        
        
        
        
        interface | ContactsContract.FullNameStyleConstants for various styles of combining given name, family name etc into a full name. | 
| 
        
        
        
        
        class | ContactsContract.GroupsConstants for the groups table. | 
| 
        
        
        
        
        interface | ContactsContract.GroupsColumns
 | 
| 
        
        
        
        
        class | ContactsContract.IntentsContains helper classes used to create or manage  | 
| 
        
        
        
        
        class | ContactsContract.PhoneLookupA table that represents the result of looking up a phone number, for example for caller ID. | 
| 
        
        
        
        
        interface | ContactsContract.PhoneLookupColumns
 | 
| 
        
        
        
        
        interface | ContactsContract.PhoneticNameStyleConstants for various styles of capturing the pronunciation of a person's name. | 
| 
        
        
        
        
        class | ContactsContract.PinnedPositionsContact-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.PresenceThis class was deprecated in API level 5. This old name was never meant to be made public. Do not use. | 
| 
        
        
        
        
        interface | ContactsContract.PresenceColumnsAdditional data mixed in with  | 
| 
        
        
        
        
        class | ContactsContract.ProfileConstants for the user's profile data, which is represented as a single contact on the device that represents the user. | 
| 
        
        
        
        
        class | ContactsContract.ProfileSyncStateA table provided for sync adapters to use for storing private sync state data for the user's personal profile. | 
| 
        
        
        
        
        class | ContactsContract.ProviderStatusAPI for inquiring about the general status of the provider. | 
| 
        
        
        
        
        class | ContactsContract.QuickContactHelper methods to display QuickContact dialogs that display all the information belonging to
 a specific  | 
| 
        
        
        
        
        class | ContactsContract.RawContactsConstants for the raw contacts table, which contains one row of contact information for each person in each synced account. | 
| 
        
        
        
        
        interface | ContactsContract.RawContactsColumns
 | 
| 
        
        
        
        
        class | ContactsContract.RawContactsEntityConstants 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.SearchSnippetsAdditional column returned by
  | 
| 
        
        
        
        
        class | ContactsContract.Settings
 Contacts-specific settings for various  | 
| 
        
        
        
        
        interface | ContactsContract.SettingsColumns
 | 
| 
        
        
        
        
        class | ContactsContract.SimAccountA parcelable class encapsulating account data for contacts that originate from a SIM card. | 
| 
        
        
        
        
        class | ContactsContract.SimContactsClass containing utility methods around determine what accounts in the ContactsProvider are related to the SIM cards in the device. | 
| 
        
        
        
        
        interface | ContactsContract.StatusColumnsSocial status update columns. | 
| 
        
        
        
        
        class | ContactsContract.StatusUpdates
 A status update is linked to a  | 
| 
        
        
        
        
        interface | ContactsContract.SyncColumnsColumns that appear when each row of a table belongs to a specific account, including sync information that an account may need. | 
| 
        
        
        
        
        class | ContactsContract.SyncStateA table provided for sync adapters to use for storing private sync state data for contacts. | 
| Constants | |
|---|---|
| String | AUTHORITYThe authority for the contacts provider | 
| String | CALLER_IS_SYNCADAPTERAn optional URI parameter for insert, update, or delete queries that allows the caller to specify that it is a sync adapter. | 
| String | DEFERRED_SNIPPETINGA key to a boolean in the "extras" bundle of the cursor. | 
| String | DEFERRED_SNIPPETING_QUERYKey to retrieve the original deferred snippeting from the cursor on the client side. | 
| String | DIRECTORY_PARAM_KEYQuery parameter that should be used by the client to access a specific
  | 
| String | LIMIT_PARAM_KEYA query parameter that limits the number of results returned for supported URIs. | 
| String | PRIMARY_ACCOUNT_NAMEA query parameter specifing a primary account. | 
| String | PRIMARY_ACCOUNT_TYPEA query parameter specifing a primary account. | 
| String | REMOVE_DUPLICATE_ENTRIESA boolean parameter for  | 
| String | STREQUENT_PHONE_ONLYA boolean parameter for  | 
| Fields | |
|---|---|
| 
    public
    static
    final
    Uri | AUTHORITY_URIA 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 | |
|---|---|
Constants
AUTHORITY
public static final String AUTHORITY
The authority for the contacts provider
Constant Value: "com.android.contacts"
CALLER_IS_SYNCADAPTER
public static final 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
 RawContacts.DIRTY is not automatically set and the
 "syncToNetwork" parameter is set to false when calling
 ContentResolver.notifyChange(android.net.Uri, android.database.ContentObserver, boolean).
 This prevents an unnecessary extra synchronization, see the discussion of
 the delete operation in RawContacts.
Constant Value: "caller_is_syncadapter"
DEFERRED_SNIPPETING
public static final 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
public static final String DEFERRED_SNIPPETING_QUERY
Key to retrieve the original deferred snippeting from the cursor on the client side.
Constant Value: "deferred_snippeting_query"
DIRECTORY_PARAM_KEY
public static final String DIRECTORY_PARAM_KEY
Query parameter that should be used by the client to access a specific
 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
public static final String LIMIT_PARAM_KEY
A query parameter that limits the number of results returned for supported URIs. The parameter value should be an integer.
This parameter is not supported by all URIs.  Supported URIs include, but not limited to,
 Contacts.CONTENT_URI,
 RawContacts.CONTENT_URI,
 Data.CONTENT_URI,
 ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
 ContactsContract.CommonDataKinds.Callable.CONTENT_URI,
 ContactsContract.CommonDataKinds.Email.CONTENT_URI,
 ContactsContract.CommonDataKinds.Contactables.CONTENT_URI,
 
In order to limit the number of rows returned by a non-supported URI, you can implement a
 CursorWrapper and override the CursorWrapper.getCount() methods.
Constant Value: "limit"
PRIMARY_ACCOUNT_NAME
public static final 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
public static final 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
public static final 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
public static final String STREQUENT_PHONE_ONLY
A boolean parameter for Contacts.CONTENT_STREQUENT_URI and
 Contacts.CONTENT_STREQUENT_FILTER_URI, which requires the ContactsProvider to
 return only phone-related results.
Constant Value: "strequent_phone_only"
Fields
AUTHORITY_URI
public static final Uri AUTHORITY_URI
A content:// style uri to the authority for the contacts provider
Public constructors
ContactsContract
public ContactsContract ()
Public methods
isProfileId
public static 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. | 
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
