Android APIs
public static class

ContactsContract.StatusUpdates

extends Object
implements ContactsContract.PresenceColumns ContactsContract.StatusColumns
java.lang.Object
   ↳ android.provider.ContactsContract.StatusUpdates
Known Direct Subclasses

Class Overview

A status update is linked to a ContactsContract.Data row and captures the user's latest status update via the corresponding source, e.g. "Having lunch" via "Google Talk".

There are two ways a status update can be inserted: by explicitly linking it to a Data row using DATA_ID or indirectly linking it to a data row using a combination of PROTOCOL (or CUSTOM_PROTOCOL) and IM_HANDLE. There is no difference between insert and update, you can use either.

Inserting or updating a status update for the user's profile requires either using the DATA_ID to identify the data row to attach the update to, or PROFILE_CONTENT_URI to ensure that the change is scoped to the profile.

You cannot use update(Uri, ContentValues, String, String[]) to change a status, but insert(Uri, ContentValues) will replace the latests status if it already exists.

Use bulkInsert(Uri, ContentValues[]) to insert/update statuses for multiple contacts at once.

Columns

StatusUpdates
long DATA_ID read/write Reference to the _ID entry that owns this presence. If this field is not specified, the provider will attempt to find a data row that matches the PROTOCOL (or CUSTOM_PROTOCOL) and IM_HANDLE columns.
long PROTOCOL read/write See ContactsContract.CommonDataKinds.Im for a list of defined protocol constants.
String CUSTOM_PROTOCOL read/write Name of the custom protocol. Should be supplied along with the PROTOCOL value PROTOCOL_CUSTOM. Should be null or omitted if PROTOCOL value is not PROTOCOL_CUSTOM.
String IM_HANDLE read/write The IM handle the presence item is for. The handle is scoped to PROTOCOL.
String IM_ACCOUNT read/write The IM account for the local user that the presence data came from.
int PRESENCE read/write Contact IM presence status. The allowed values are:

Since presence status is inherently volatile, the content provider may choose not to store this field in long-term storage.

int CHAT_CAPABILITY read/write Contact IM chat compatibility value. The allowed values combinations of the following flags. If None of these flags is set, the device can only do text messaging.

Since chat compatibility is inherently volatile as the contact's availability moves from one device to another, the content provider may choose not to store this field in long-term storage.

String STATUS read/write Contact's latest status update, e.g. "having toast for breakfast"
long STATUS_TIMESTAMP read/write The absolute time in milliseconds when the status was entered by the user. If this value is not provided, the provider will follow this logic: if there was no prior status update, the value will be left as null. If there was a prior status update, the provider will default this field to the current time.
String STATUS_RES_PACKAGE read/write The package containing resources for this status: label and icon.
long STATUS_LABEL read/write The resource ID of the label describing the source of contact status, e.g. "Google Talk". This resource is scoped by the STATUS_RES_PACKAGE.
long STATUS_ICON read/write The resource ID of the icon for the source of contact status. This resource is scoped by the STATUS_RES_PACKAGE.

Summary

Constants
String CONTENT_ITEM_TYPE The MIME type of a CONTENT_URI subdirectory of a single status update detail.
String CONTENT_TYPE The MIME type of CONTENT_URI providing a directory of status update details.
[Expand]
Inherited Constants
From interface android.provider.ContactsContract.PresenceColumns
From interface android.provider.ContactsContract.StatusColumns
Fields
public static final Uri CONTENT_URI The content:// style URI for this table
public static final Uri PROFILE_CONTENT_URI The content:// style URI for this table, specific to the user's profile.
Public Methods
final static int getPresenceIconResourceId(int status)
Gets the resource ID for the proper presence icon.
final static int getPresencePrecedence(int status)
Returns the precedence of the status code the higher number being the higher precedence.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String CONTENT_ITEM_TYPE

Added in API level 5

The MIME type of a CONTENT_URI subdirectory of a single status update detail.

Constant Value: "vnd.android.cursor.item/status-update"

public static final String CONTENT_TYPE

Added in API level 5

The MIME type of CONTENT_URI providing a directory of status update details.

Constant Value: "vnd.android.cursor.dir/status-update"

Fields

public static final Uri CONTENT_URI

Added in API level 5

The content:// style URI for this table

public static final Uri PROFILE_CONTENT_URI

Added in API level 14

The content:// style URI for this table, specific to the user's profile.

Public Methods

public static final int getPresenceIconResourceId (int status)

Added in API level 5

Gets the resource ID for the proper presence icon.

Parameters
status the status to get the icon for
Returns
  • the resource ID for the proper presence icon

public static final int getPresencePrecedence (int status)

Added in API level 5

Returns the precedence of the status code the higher number being the higher precedence.

Parameters
status The status code.
Returns
  • An integer representing the precedence, 0 being the lowest.