Added in API level 1
Deprecated in API level 5

People


class People : BaseColumns, Contacts.PeopleColumns, Contacts.PhonesColumns, Contacts.PresenceColumns

This table contains people.

Summary

Nested classes

A subdirectory of a single person that contains all of their ContactMethods.

The extensions for a person

A sub directory of a single person that contains all of their Phones.

Constants
static String

The MIME type of a CONTENT_URI subdirectory of a single person.

static String

The MIME type of CONTENT_URI providing a directory of people.

static String

The default sort order for this table

static String

The ID of the persons preferred email.

static String

The ID of the persons preferred organization.

static String

The ID of the persons preferred phone number.

Inherited constants
Int AVAILABLE

Int AWAY

Int DO_NOT_DISTURB

Int IDLE

String IM_ACCOUNT

The IM account for the local user that the presence data came from.

Type: STRING

String IM_HANDLE

The IM handle the presence item is for. The handle is scoped to the IM_PROTOCOL.

Type: STRING

String IM_PROTOCOL

The IM service the presence is coming from. Formatted using either Contacts.ContactMethods.encodePredefinedImProtocol or Contacts.ContactMethods.encodeCustomImProtocol.

Type: STRING

Int INVISIBLE

Int OFFLINE

Presence Status definition

String PRESENCE_CUSTOM_STATUS

The user defined status line.

Type: TEXT

String PRESENCE_STATUS

The server defined status.

Type: INTEGER (one of the values below)

String PRIORITY

The priority, an integer, used by XMPP presence

Type: INTEGER

String CUSTOM_RINGTONE

A custom ringtone associated with a person. Not always present.

Type: TEXT (URI to the ringtone)

String DISPLAY_NAME

The display name. If name is not null name, else if number is not null number, else if email is not null email.

Type: TEXT

String LAST_TIME_CONTACTED

The last time a person was contacted.

Type: INTEGER

String NAME

The person's name.

Type: TEXT

String NOTES

Notes about the person.

Type: TEXT

String PHONETIC_NAME

Phonetic equivalent of the person's name, in a locale-dependent character set (e.g. hiragana for Japanese). Used for pronunciation and/or collation in some languages.

Type: TEXT

String PHOTO_VERSION

The server version of the photo

Type: TEXT (the version number portion of the photo URI)

String SEND_TO_VOICEMAIL

Whether the person should always be sent to voicemail. Not always present.

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 person has been contacted

Type: INTEGER

String ISPRIMARY

Whether this is the primary phone number

Type: INTEGER (if set, non-0 means true)

String LABEL

The user provided label for the phone number, only used if TYPE is TYPE_CUSTOM.

Type: TEXT

String NUMBER

The phone number as the user entered it.

Type: TEXT

String NUMBER_KEY

The normalized phone number

Type: TEXT

String TYPE

The type of the the phone number.

Type: INTEGER (one of the constants below)

Int TYPE_CUSTOM

Int TYPE_FAX_HOME

Int TYPE_FAX_WORK

Int TYPE_HOME

Int TYPE_MOBILE

Int TYPE_OTHER

Int TYPE_PAGER

Int TYPE_WORK

String _COUNT

The count of rows in a directory.

Type: INTEGER

String _ID

The unique ID for a row.

Type: INTEGER (long)

Public methods
static Uri!
addToGroup(resolver: ContentResolver!, personId: Long, groupName: String!)

Adds a person to a group referred to by name.

static Uri!
addToGroup(resolver: ContentResolver!, personId: Long, groupId: Long)

Adds a person to a group.

static Uri!
addToMyContactsGroup(resolver: ContentResolver!, personId: Long)

Adds a person to the My Contacts group.

static Uri!

Creates a new contacts and adds it to the "My Contacts" group.

static Bitmap!
loadContactPhoto(context: Context!, person: Uri!, placeholderImageResource: Int, options: BitmapFactory.Options!)

Opens an InputStream for the person's photo and returns the photo as a Bitmap.

static Unit
markAsContacted(resolver: ContentResolver!, personId: Long)

This API is no longer supported as of O.

static InputStream!

Opens an InputStream for the person's photo and returns the photo as a Bitmap.

static Cursor!
queryGroups(resolver: ContentResolver!, person: Long)

static Unit
setPhotoData(cr: ContentResolver!, person: Uri!, data: ByteArray!)

Set the photo for this person.

Properties
static Uri!

The content:// style URL for filtering people by name.

static Uri!

The content:// style URL for this table

static Uri!

The content:// style URL for the table that holds the deleted contacts.

Constants

CONTENT_ITEM_TYPE

Added in API level 1
static val CONTENT_ITEM_TYPE: String

Deprecated: see android.provider.ContactsContract

The MIME type of a CONTENT_URI subdirectory of a single person.

Value: "vnd.android.cursor.item/person"

CONTENT_TYPE

Added in API level 1
static val CONTENT_TYPE: String

Deprecated: see android.provider.ContactsContract

The MIME type of CONTENT_URI providing a directory of people.

Value: "vnd.android.cursor.dir/person"

DEFAULT_SORT_ORDER

Added in API level 1
static val DEFAULT_SORT_ORDER: String

Deprecated: see android.provider.ContactsContract

The default sort order for this table

Value: "name ASC"

PRIMARY_EMAIL_ID

Added in API level 1
static val PRIMARY_EMAIL_ID: String

Deprecated: see android.provider.ContactsContract

The ID of the persons preferred email.

Type: INTEGER (foreign key to contact_methods table on the _ID field)

Value: "primary_email"

PRIMARY_ORGANIZATION_ID

Added in API level 1
static val PRIMARY_ORGANIZATION_ID: String

Deprecated: see android.provider.ContactsContract

The ID of the persons preferred organization.

Type: INTEGER (foreign key to organizations table on the _ID field)

Value: "primary_organization"

PRIMARY_PHONE_ID

Added in API level 1
static val PRIMARY_PHONE_ID: String

Deprecated: see android.provider.ContactsContract

The ID of the persons preferred phone number.

Type: INTEGER (foreign key to phones table on the _ID field)

Value: "primary_phone"

Public methods

addToGroup

Added in API level 1
static fun addToGroup(
    resolver: ContentResolver!,
    personId: Long,
    groupName: String!
): Uri!

Deprecated: see android.provider.ContactsContract

Adds a person to a group referred to by name.

Parameters
resolver ContentResolver!: the resolver to use
personId Long: the person to add to the group
groupName String!: the name of the group to add the contact to
Return
Uri! the URI of the group membership row
Exceptions
java.lang.IllegalStateException if the group can't be found

addToGroup

Added in API level 1
static fun addToGroup(
    resolver: ContentResolver!,
    personId: Long,
    groupId: Long
): Uri!

Deprecated: see android.provider.ContactsContract

Adds a person to a group.

Parameters
resolver ContentResolver!: the resolver to use
personId Long: the person to add to the group
groupId Long: the group to add the person to
Return
Uri! the URI of the group membership row

addToMyContactsGroup

Added in API level 1
static fun addToMyContactsGroup(
    resolver: ContentResolver!,
    personId: Long
): Uri!

Deprecated: see android.provider.ContactsContract

Adds a person to the My Contacts group.

Parameters
resolver ContentResolver!: the resolver to use
personId Long: the person to add to the group
Return
Uri! the URI of the group membership row
Exceptions
java.lang.IllegalStateException if the My Contacts group can't be found

createPersonInMyContactsGroup

Added in API level 1
static fun createPersonInMyContactsGroup(
    resolver: ContentResolver!,
    values: ContentValues!
): Uri!

Deprecated: see android.provider.ContactsContract

Creates a new contacts and adds it to the "My Contacts" group.

Parameters
resolver ContentResolver!: the ContentResolver to use
values ContentValues!: the values to use when creating the contact
Return
Uri! the URI of the contact, or null if the operation fails

loadContactPhoto

Added in API level 1
static fun loadContactPhoto(
    context: Context!,
    person: Uri!,
    placeholderImageResource: Int,
    options: BitmapFactory.Options!
): Bitmap!

Deprecated: see android.provider.ContactsContract

Opens an InputStream for the person's photo and returns the photo as a Bitmap. If the person's photo isn't present returns the placeholderImageResource instead.

Parameters
context Context!: the Context
person Uri!: the person whose photo should be used
placeholderImageResource Int: the image resource to use if the person doesn't have a photo
options BitmapFactory.Options!: the decoding options, can be set to null

markAsContacted

Added in API level 1
static fun markAsContacted(
    resolver: ContentResolver!,
    personId: Long
): Unit

Deprecated: Deprecated in Java.

This API is no longer supported as of O.

openContactPhotoInputStream

Added in API level 1
static fun openContactPhotoInputStream(
    cr: ContentResolver!,
    person: Uri!
): InputStream!

Deprecated: see android.provider.ContactsContract

Opens an InputStream for the person's photo and returns the photo as a Bitmap. If the person's photo isn't present returns the placeholderImageResource instead.

Parameters
person Uri!: the person whose photo should be used

queryGroups

Added in API level 1
static fun queryGroups(
    resolver: ContentResolver!,
    person: Long
): Cursor!

Deprecated: see android.provider.ContactsContract

setPhotoData

Added in API level 1
static fun setPhotoData(
    cr: ContentResolver!,
    person: Uri!,
    data: ByteArray!
): Unit

Deprecated: see android.provider.ContactsContract

Set the photo for this person. data may be null

Parameters
cr ContentResolver!: the ContentResolver to use
person Uri!: the Uri of the person whose photo is to be updated
data ByteArray!: the byte[] that represents the photo

Properties

CONTENT_FILTER_URI

Added in API level 1
static val CONTENT_FILTER_URI: Uri!

Deprecated: see android.provider.ContactsContract

The content:// style URL for filtering people by name. The filter argument should be passed as an additional path segment after this URI.

CONTENT_URI

Added in API level 1
static val CONTENT_URI: Uri!

Deprecated: see android.provider.ContactsContract

The content:// style URL for this table

DELETED_CONTENT_URI

Added in API level 1
static val DELETED_CONTENT_URI: Uri!

Deprecated: see android.provider.ContactsContract

The content:// style URL for the table that holds the deleted contacts.