Added in API level 19

Threads


class Threads : Telephony.ThreadsColumns

Helper functions for the "threads" table used by MMS and SMS. Thread IDs are determined by the participants in a conversation and can be used to match both SMS and MMS messages. To avoid issues where applications might cache a thread ID, the thread ID of a deleted thread must not be reused to point at a new thread.

Summary

Constants
static Int

Thread type: broadcast thread.

static Int

Thread type: common thread.

Inherited constants
String ARCHIVED

If the thread is archived

Type: INTEGER (boolean)

String DATE

The date at which the thread was created.

Type: INTEGER (long)

String ERROR

Indicates whether there is a transmission error in the thread.

Type: INTEGER

String HAS_ATTACHMENT

Indicates whether this thread contains any attachments.

Type: INTEGER

String MESSAGE_COUNT

The message count of the thread.

Type: INTEGER

String READ

Indicates whether all messages of the thread have been read.

Type: INTEGER

String RECIPIENT_IDS

A string encoding of the recipient IDs of the recipients of the message, in numerical order and separated by spaces.

Type: TEXT

String SNIPPET

The snippet of the latest message in the thread.

Type: TEXT

String SNIPPET_CHARSET

The charset of the snippet.

Type: INTEGER

String TYPE

Type of the thread, either Threads.COMMON_THREAD or Threads.BROADCAST_THREAD.

Type: INTEGER

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 Long
getOrCreateThreadId(context: Context!, recipient: String!)

This is a single-recipient version of getOrCreateThreadId.

static Long
getOrCreateThreadId(context: Context!, recipients: MutableSet<String!>!)

Given a set of recipients return its thread ID.

Properties
static Uri!

The content:// style URL for this table, by conversation.

static Uri!

The content:// style URL for this table, for obsolete threads.

Constants

BROADCAST_THREAD

Added in API level 19
static val BROADCAST_THREAD: Int

Thread type: broadcast thread.

Value: 1

COMMON_THREAD

Added in API level 19
static val COMMON_THREAD: Int

Thread type: common thread.

Value: 0

Public methods

getOrCreateThreadId

Added in API level 23
static fun getOrCreateThreadId(
    context: Context!,
    recipient: String!
): Long

This is a single-recipient version of getOrCreateThreadId. It's convenient for use with SMS messages.

Parameters
context Context!: the context object to use.
recipient String!: the recipient to send to.

getOrCreateThreadId

Added in API level 23
static fun getOrCreateThreadId(
    context: Context!,
    recipients: MutableSet<String!>!
): Long

Given a set of recipients return its thread ID.

If a thread exists containing the provided participants, return its thread ID. Otherwise, this will create a new thread containing the provided participants and return its ID.

Properties

CONTENT_URI

Added in API level 19
static val CONTENT_URI: Uri!

The content:// style URL for this table, by conversation.

OBSOLETE_THREADS_URI

Added in API level 19
static val OBSOLETE_THREADS_URI: Uri!

The content:// style URL for this table, for obsolete threads.