Added in API level 14

Profile


class Profile : BaseColumns, ContactsContract.ContactNameColumns, ContactsContract.ContactOptionsColumns, ContactsContract.ContactStatusColumns, ContactsContract.ContactsColumns

Constants for the user's profile data, which is represented as a single contact on the device that represents the user. The profile contact is not aggregated together automatically in the same way that normal contacts are; instead, each account (including data set, if applicable) on the device may contribute a single raw contact representing the user's personal profile data from that source.

Access to the profile entry through these URIs (or incidental access to parts of the profile if retrieved directly via ID) requires additional permissions beyond the read/write contact permissions required by the provider. Querying for profile data requires android.permission.READ_PROFILE permission, and inserting or updating profile data requires android.permission.WRITE_PROFILE permission.

Operations

Insert
The user's profile entry cannot be created explicitly (attempting to do so will throw an exception). When a raw contact is inserted into the profile, the provider will check for the existence of a profile on the device. If one is found, the raw contact's RawContacts.CONTACT_ID column gets the _ID of the profile Contact. If no match is found, the profile Contact is created and its _ID is put into the RawContacts.CONTACT_ID column of the newly inserted raw contact.
Update
The profile Contact has the same update restrictions as Contacts in general, but requires the android.permission.WRITE_PROFILE permission.
Delete
The profile Contact cannot be explicitly deleted. It will be removed automatically if all of its constituent raw contact entries are deleted.
Query
  • The CONTENT_URI for profiles behaves in much the same way as retrieving a contact by ID, except that it will only ever return the user's profile contact.
  • The profile contact supports all of the same sub-paths as an individual contact does - the content of the profile contact can be retrieved as entities or data rows. Similarly, specific raw contact entries can be retrieved by appending the desired raw contact ID within the profile.

Summary

Constants
static Long

The minimum ID for any entity that belongs to the profile.

Inherited constants
String CONTACT_CHAT_CAPABILITY

Contact Chat Capabilities. See StatusUpdates for individual definitions.

Type: NUMBER

String CONTACT_PRESENCE

Contact presence status. See StatusUpdates for individual status definitions.

Type: NUMBER

String CONTACT_STATUS

Contact's latest status update.

Type: TEXT

String CONTACT_STATUS_ICON

The resource ID of the icon for the source of contact status. This resource is scoped by the CONTACT_STATUS_RES_PACKAGE.

Type: NUMBER

String CONTACT_STATUS_LABEL

The resource ID of the label describing the source of contact status, e.g. "Google Talk". This resource is scoped by the CONTACT_STATUS_RES_PACKAGE.

Type: NUMBER

String CONTACT_STATUS_RES_PACKAGE

The package containing resources for this status: label and icon.

Type: TEXT

String CONTACT_STATUS_TIMESTAMP

The absolute time in milliseconds when the latest status was inserted/updated.

Type: NUMBER

String CONTACT_LAST_UPDATED_TIMESTAMP

Timestamp (milliseconds since epoch) of when this contact was last updated. This includes updates to all data associated with this contact including raw contacts. Any modification (including deletes and inserts) of underlying contact data are also reflected in this timestamp.

String DISPLAY_NAME

The display name for the contact.

Type: TEXT

String HAS_PHONE_NUMBER

An indicator of whether this contact has at least one phone number. "1" if there is at least one phone number, "0" otherwise.

Type: INTEGER

String IN_DEFAULT_DIRECTORY

Flag that reflects whether the contact exists inside the default directory. Ie, whether the contact is designed to only be visible outside search.

String IN_VISIBLE_GROUP

Flag that reflects the Groups.GROUP_VISIBLE state of any CommonDataKinds.GroupMembership for this contact.

String IS_USER_PROFILE

Flag that reflects whether this contact represents the user's personal profile entry.

String LOOKUP_KEY

An opaque value that contains hints on how to find the contact if its row id changed as a result of a sync or aggregation.

String NAME_RAW_CONTACT_ID

Reference to the row in the RawContacts table holding the contact name.

Type: INTEGER REFERENCES raw_contacts(_id)

String PHOTO_FILE_ID

Photo file ID of the full-size photo. If present, this will be used to populate PHOTO_URI. The ID can also be used with ContactsContract.DisplayPhoto.CONTENT_URI to create a URI to the photo. If this is present, PHOTO_ID is also guaranteed to be populated.

Type: INTEGER

String PHOTO_ID

Reference to the row in the data table holding the photo. A photo can be referred to either by ID (this field) or by URI (see PHOTO_THUMBNAIL_URI and PHOTO_URI). If PHOTO_ID is null, consult PHOTO_URI or PHOTO_THUMBNAIL_URI, which is a more generic mechanism for referencing the contact photo, especially for contacts returned by non-local directories (see Directory).

Type: INTEGER REFERENCES data(_id)

String PHOTO_THUMBNAIL_URI

A URI that can be used to retrieve a thumbnail of the contact's photo. A photo can be referred to either by a URI (this field or PHOTO_URI) or by ID (see PHOTO_ID). If PHOTO_ID is not null, PHOTO_URI and PHOTO_THUMBNAIL_URI shall not be null (but not necessarily vice versa). If the content provider does not differentiate between full-size photos and thumbnail photos, PHOTO_THUMBNAIL_URI and PHOTO_URI can contain the same value, but either both shall be null or both not null.

Type: TEXT

String PHOTO_URI

A URI that can be used to retrieve the contact's full-size photo. If PHOTO_FILE_ID is not null, this will be populated with a URI based off ContactsContract.DisplayPhoto.CONTENT_URI. Otherwise, this will be populated with the same value as PHOTO_THUMBNAIL_URI. A photo can be referred to either by a URI (this field) or by ID (see PHOTO_ID). If either PHOTO_FILE_ID or PHOTO_ID is not null, PHOTO_URI and PHOTO_THUMBNAIL_URI shall not be null (but not necessarily vice versa). Thus using PHOTO_URI is a more robust method of retrieving contact photos.

Type: TEXT

String CUSTOM_RINGTONE

URI for a custom ringtone associated with the contact. If null or missing, the default ringtone is used.

Type: TEXT (URI to the ringtone)

String LAST_TIME_CONTACTED

The last time a contact was contacted.

Caution: If you publish your app to the Google Play Store, this field is obsolete, regardless of Android version. For more information, see the Contacts Provider page.

Type: INTEGER

String PINNED

The position at which the contact is pinned. If PinnedPositions.UNPINNED, the contact is not pinned. Also see PinnedPositions.

Type: INTEGER

String SEND_TO_VOICEMAIL

Whether the contact should always be sent to voicemail. If missing, defaults to false.

Type: INTEGER (0 for false, 1 for true)

String STARRED

Is the contact starred?

Type: INTEGER (boolean)

String TIMES_CONTACTED

The number of times a contact has been contacted.

Caution: If you publish your app to the Google Play Store, this field is obsolete, regardless of Android version. For more information, see the Contacts Provider page.

Type: INTEGER

String DISPLAY_NAME_ALTERNATIVE

An alternative representation of the display name, such as "family name first" instead of "given name first" for Western names. If an alternative is not available, the values should be the same as DISPLAY_NAME_PRIMARY.

A contacts provider is free to provide alternatives as necessary for its target market. For example the default Android Open Source Project contacts provider currently provides an alternative in a single case: if the display name is based on the structured name and the structured name follows the Western full name style, then the field contains the "family name first" version of the full name. Other cases may be added later.

String DISPLAY_NAME_PRIMARY

The standard text shown as the contact's display name, based on the best available information for the contact (for example, it might be the email address if the name is not available). The information actually used to compute the name is stored in DISPLAY_NAME_SOURCE.

A contacts provider is free to choose whatever representation makes most sense for its target market. For example in the default Android Open Source Project implementation, if the display name is based on the structured name and the structured name follows the Western full-name style, then this field contains the "given name first" version of the full name.

String DISPLAY_NAME_SOURCE

The kind of data that is used as the display name for the contact, such as structured name or email address. See DisplayNameSources.

String PHONETIC_NAME

Pronunciation of the full name in the phonetic alphabet specified by PHONETIC_NAME_STYLE.

The value may be set manually by the user. This capability is of interest only in countries with commonly used phonetic alphabets, such as Japan and Korea. See PhoneticNameStyle.

String PHONETIC_NAME_STYLE

The phonetic alphabet used to represent the PHONETIC_NAME. See PhoneticNameStyle.

String SORT_KEY_ALTERNATIVE

Sort key based on the alternative representation of the full name, DISPLAY_NAME_ALTERNATIVE. Thus for Western names, it is the one using the "family name first" format.

String SORT_KEY_PRIMARY

Sort key that takes into account locale-based traditions for sorting names in address books. The default sort key is DISPLAY_NAME_PRIMARY. For Chinese names the sort key is the name's Pinyin spelling, and for Japanese names it is the Hiragana version of the phonetic name.

String _COUNT

The count of rows in a directory.

Type: INTEGER

String _ID

The unique ID for a row.

Type: INTEGER (long)

Properties
static Uri!

Uri for referencing the raw contacts that make up the user's profile Contacts entry.

static Uri!

The content:// style URI for this table, which requests the contact entry representing the user's personal profile data.

static Uri!

Uri for referencing the user's profile Contacts entry, Provides OpenableColumns columns when queried, or returns the user's profile contact formatted as a vCard when opened through ContentResolver.openAssetFileDescriptor(Uri, String).

Constants

MIN_ID

Added in API level 14
static val MIN_ID: Long

The minimum ID for any entity that belongs to the profile. This essentially defines an ID-space in which profile data is stored, and is used by the provider to determine whether a request via a non-profile-specific URI should be directed to the profile data rather than general contacts data, along with all the special permission checks that entails. Callers may use isProfileId to check whether a specific ID falls into the set of data intended for the profile.

Value: 9223372034707292160L

Properties

CONTENT_RAW_CONTACTS_URI

Added in API level 14
static val CONTENT_RAW_CONTACTS_URI: Uri!

Uri for referencing the raw contacts that make up the user's profile Contacts entry. An individual raw contact entry within the profile can be addressed by appending the raw contact ID. The entities or data within that specific raw contact can be requested by appending the entity or data path as well.

CONTENT_URI

Added in API level 14
static val CONTENT_URI: Uri!

The content:// style URI for this table, which requests the contact entry representing the user's personal profile data.

CONTENT_VCARD_URI

Added in API level 14
static val CONTENT_VCARD_URI: Uri!

Uri for referencing the user's profile Contacts entry, Provides OpenableColumns columns when queried, or returns the user's profile contact formatted as a vCard when opened through ContentResolver.openAssetFileDescriptor(Uri, String).