FileDocCategorySizeDatePackage
ContactsContract.javaAPI DocAndroid 5.1 API353241Thu Mar 12 22:22:10 GMT 2015android.provider

ContactsContract

public final class ContactsContract extends Object

The contract between the contacts provider and applications. Contains definitions for the supported URIs and columns. These APIs supersede {@link 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 {@link Data} table 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 {@link RawContacts} table 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 {@link Contacts} table 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:

  • {@link 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.
  • {@link StatusUpdates}, which contains social status updates including IM availability.
  • {@link AggregationExceptions}, which is used for manual aggregation and disaggregation of raw contacts
  • {@link Settings}, which contains visibility and sync settings for accounts and groups.
  • {@link SyncState}, which contains free-form data maintained on behalf of sync adapters
  • {@link PhoneLookup}, which is used for quick caller-ID lookup

Fields Summary
public static final String
AUTHORITY
The authority for the contacts provider
public static final android.net.Uri
AUTHORITY_URI
A content:// style uri to the authority for the contacts provider
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 {@link RawContacts#DIRTY} is not automatically set and the "syncToNetwork" parameter is set to false when calling {@link ContentResolver#notifyChange(android.net.Uri, android.database.ContentObserver, boolean)}. This prevents an unnecessary extra synchronization, see the discussion of the delete operation in {@link RawContacts}.
public static final String
DIRECTORY_PARAM_KEY
Query parameter that should be used by the client to access a specific {@link Directory}. The parameter value should be the _ID of the corresponding directory, e.g. {@code content://com.android.contacts/data/emails/filter/acme?directory=3}
public static final String
LIMIT_PARAM_KEY
A query parameter that limits the number of results returned. The parameter value should be an integer.
public static final String
PRIMARY_ACCOUNT_NAME
A query parameter specifing a primary account. This parameter should be used with {@link #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.
public static final String
PRIMARY_ACCOUNT_TYPE
A query parameter specifing a primary account. This parameter should be used with {@link #PRIMARY_ACCOUNT_NAME}. See the doc in {@link #PRIMARY_ACCOUNT_NAME}.
public static final String
STREQUENT_PHONE_ONLY
A boolean parameter for {@link Contacts#CONTENT_STREQUENT_URI} and {@link Contacts#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.)
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).
public static final String
DEFERRED_SNIPPETING_QUERY
Key to retrieve the original deferred snippeting from the cursor on the client side.
public static final String
REMOVE_DUPLICATE_ENTRIES
A boolean parameter for {@link CommonDataKinds.Phone#CONTENT_URI Phone.CONTENT_URI}, {@link CommonDataKinds.Email#CONTENT_URI Email.CONTENT_URI}, and {@link CommonDataKinds.StructuredPostal#CONTENT_URI StructuredPostal.CONTENT_URI}. This enables a content provider to remove duplicate entries in results.
Constructors Summary
Methods Summary
public static booleanisProfileId(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.

param
id The ID to check.
return
Whether the ID is associated with profile data.

    

                                                                           
         
        return id >= Profile.MIN_ID;