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
Contacts
.
ContactsContract defines an extensible database of contact-related information. Contact information is stored in a three-tier data model:
ContactsContract.Contacts.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.
ContactsContract.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).
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:
ContactsContract.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.
ContactsContract.StatusUpdates
, which contains social status updates including IM
availability.
ContactsContract.AggregationExceptions
, which is used for manual aggregation and
disaggregation of raw contacts
Settings
, which contains visibility and sync settings for accounts
and groups.
ContactsContract.SyncState
, which contains free-form data maintained on behalf of sync
adapters
ContactsContract.PhoneLookup
, which is used for quick caller-ID lookupModifier and Type | Class and Description |
---|---|
static class |
ContactsContract.AggregationExceptions
Constants for the contact aggregation exceptions table, which contains
aggregation rules overriding those used by automatic aggregation.
|
static class |
ContactsContract.Authorization
API for obtaining a pre-authorized version of a URI that normally requires special
permission (beyond READ_CONTACTS) to read.
|
protected static interface |
ContactsContract.BaseSyncColumns
Generic columns for use by sync adapters.
|
static class |
ContactsContract.CommonDataKinds
Container for definitions of common data types stored in the
ContactsContract.Data
table. |
static class |
ContactsContract.ContactCounts
URI parameter and cursor extras that return counts of rows grouped by the
address book index, which is usually the first letter of the sort key.
|
protected static interface |
ContactsContract.ContactNameColumns
Contact name and contact name metadata columns in the RawContacts table.
|
protected static interface |
ContactsContract.ContactOptionsColumns
Columns of
ContactsContract.Contacts that track the user's
preferences for, or interactions with, the contact. |
static class |
ContactsContract.Contacts
Constants for the contacts table, which contains a record per aggregate
of raw contacts representing the same person.
|
protected static 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 . |
protected static interface |
ContactsContract.ContactStatusColumns |
static class |
ContactsContract.Data
Constants for the data table, which contains data points tied to a raw
contact.
|
protected static interface |
ContactsContract.DataColumns
Columns in the Data table.
|
protected static interface |
ContactsContract.DataColumnsWithJoins
Combines all columns returned by
ContactsContract.Data table queries. |
static class |
ContactsContract.DataUsageFeedback
API allowing applications to send usage information for each
ContactsContract.Contacts.Data row to the
Contacts Provider. |
static class |
ContactsContract.Directory
A Directory represents a contacts corpus, e.g.
|
static interface |
ContactsContract.DisplayNameSources
Types of data used to produce the display name for a contact.
|
static class |
ContactsContract.DisplayPhoto
Helper class for accessing full-size photos by photo file ID.
|
static interface |
ContactsContract.FullNameStyle
Constants for various styles of combining given name, family name etc into
a full name.
|
static class |
ContactsContract.Groups
Constants for the groups table.
|
protected static interface |
ContactsContract.GroupsColumns |
static class |
ContactsContract.Intents
Contains helper classes used to create or manage
Intents
that involve contacts. |
static class |
ContactsContract.PhoneLookup
A table that represents the result of looking up a phone number, for
example for caller ID.
|
protected static interface |
ContactsContract.PhoneLookupColumns |
static interface |
ContactsContract.PhoneticNameStyle
Constants for various styles of capturing the pronunciation of a person's name.
|
static class |
ContactsContract.PhotoFiles
Constants for the photo files table, which tracks metadata for hi-res photos
stored in the file system.
|
protected static interface |
ContactsContract.PhotoFilesColumns
Columns in the PhotoFiles table.
|
static class |
ContactsContract.Preferences |
static class |
ContactsContract.Presence
Deprecated.
This old name was never meant to be made public. Do not use.
|
protected static interface |
ContactsContract.PresenceColumns
Additional data mixed in with
ContactsContract.ContactStatusColumns to link
back to specific BaseColumns._ID entries. |
static class |
ContactsContract.Profile
Constants for the user's profile data, which is represented as a single contact on
the device that represents the user.
|
static class |
ContactsContract.ProfileSyncState
A table provided for sync adapters to use for storing private sync state data for the
user's personal profile.
|
static class |
ContactsContract.ProviderStatus
Private API for inquiring about the general status of the provider.
|
static class |
ContactsContract.QuickContact
Helper methods to display QuickContact dialogs that allow users to pivot on
a specific
Contacts entry. |
static class |
ContactsContract.RawContacts
Constants for the raw contacts table, which contains one row of contact
information for each person in each synced account.
|
protected static interface |
ContactsContract.RawContactsColumns |
static 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.
|
static class |
ContactsContract.SearchSnippetColumns
Additional column returned by the
Contacts#CONTENT_FILTER_URI providing the
explanation of why the filter matched the contact. |
static class |
ContactsContract.Settings
Contacts-specific settings for various
Account 's. |
protected static interface |
ContactsContract.SettingsColumns |
protected static interface |
ContactsContract.StatusColumns
Social status update columns.
|
static 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. |
static class |
ContactsContract.StreamItemPhotos
Constants for the stream_item_photos table, which contains photos associated with
social stream updates.
|
protected static interface |
ContactsContract.StreamItemPhotosColumns
Columns in the StreamItemPhotos table.
|
static class |
ContactsContract.StreamItems
Constants for the stream_items table, which contains social stream updates from
the user's contact list.
|
protected static interface |
ContactsContract.StreamItemsColumns
Columns in the StreamItems table.
|
protected static 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.
|
static class |
ContactsContract.SyncState
A table provided for sync adapters to use for storing private sync state data for contacts.
|
static interface |
ContactsContract.SyncStateColumns
Deprecated.
use SyncState instead
|
Modifier and Type | Field and Description |
---|---|
static String |
AUTHORITY
The authority for the contacts provider
|
static Uri |
AUTHORITY_URI
A content:// style uri to the authority for the contacts provider
|
static 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.
|
static String |
DEFERRED_SNIPPETING
A key to a boolean in the "extras" bundle of the cursor.
|
static String |
DEFERRED_SNIPPETING_QUERY
Key to retrieve the original query on the client side.
|
static String |
DIRECTORY_PARAM_KEY
Query parameter that should be used by the client to access a specific
ContactsContract.Directory . |
static String |
LIMIT_PARAM_KEY
A query parameter that limits the number of results returned.
|
static String |
PRIMARY_ACCOUNT_NAME
A query parameter specifing a primary account.
|
static String |
PRIMARY_ACCOUNT_TYPE
A query parameter specifing a primary account.
|
static String |
REMOVE_DUPLICATE_ENTRIES
|
static 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. |
Constructor and Description |
---|
ContactsContract() |
Modifier and Type | Method and Description |
---|---|
static boolean |
isProfileId(long id)
This method can be used to identify whether the given ID is associated with profile
data.
|
static String |
snippetize(String content,
String displayName,
String query,
char snippetStartMatch,
char snippetEndMatch,
String snippetEllipsis,
int snippetMaxTokens)
Creates a snippet out of the given content that matches the given query.
|
public static final String AUTHORITY
public static final Uri AUTHORITY_URI
public static final String CALLER_IS_SYNCADAPTER
ContactsContract.SyncColumns.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 ContactsContract.RawContacts
.public static final String DIRECTORY_PARAM_KEY
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
public static final String LIMIT_PARAM_KEY
public static final String PRIMARY_ACCOUNT_NAME
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
PRIMARY_ACCOUNT_NAME
. See the doc in PRIMARY_ACCOUNT_NAME
.public static final String STREQUENT_PHONE_ONLY
Contacts#CONTENT_STREQUENT_URI
and
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
public static final String DEFERRED_SNIPPETING_QUERY
public static final String REMOVE_DUPLICATE_ENTRIES
ContactsContract.CommonDataKinds.Phone.CONTENT_URI
,
ContactsContract.CommonDataKinds.Email.CONTENT_URI
, and
ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_URI
.
This enables a content provider to remove duplicate entries in results.public static boolean isProfileId(long id)
id
- The ID to check.public static String snippetize(String content, String displayName, String query, char snippetStartMatch, char snippetEndMatch, String snippetEllipsis, int snippetMaxTokens)
content
- - The content to use to compute the snippet.displayName
- - Display name for the contact - if this already contains the search
content, no snippet should be shown.query
- - String to search for in the content.snippetStartMatch
- - Marks the start of the matching string in the snippet.snippetEndMatch
- - Marks the end of the matching string in the snippet.snippetEllipsis
- - Ellipsis string appended to the end of the snippet (if too long).snippetMaxTokens
- - Maximum number of words from the snippet that will be displayed.