# Telephony.Threads

Added in[API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Constants](https://developer.android.com/reference/android/provider/Telephony.Threads#constants)\|[Inherited Constants](https://developer.android.com/reference/android/provider/Telephony.Threads#inhconstants)\|[Fields](https://developer.android.com/reference/android/provider/Telephony.Threads#lfields)\|[Methods](https://developer.android.com/reference/android/provider/Telephony.Threads#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/provider/Telephony.Threads#inhmethods)  

# Telephony.Threads

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/provider/Telephony.Threads "View this page in Kotlin")\|Java

`
public
static
final

class
Telephony.Threads
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


implements

`[Telephony.ThreadsColumns](https://developer.android.com/reference/android/provider/Telephony.ThreadsColumns)`


`

|---|------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.provider.Telephony.Threads |

<br />

*** ** * ** ***

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                                                                     ||
|-------|------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | [BROADCAST_THREAD](https://developer.android.com/reference/android/provider/Telephony.Threads#BROADCAST_THREAD) Thread type: broadcast thread. |
| `int` | [COMMON_THREAD](https://developer.android.com/reference/android/provider/Telephony.Threads#COMMON_THREAD) Thread type: common thread.          |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ### Inherited constants                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From interface[android.provider.Telephony.ThreadsColumns](https://developer.android.com/reference/android/provider/Telephony.ThreadsColumns) |--------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [String](https://developer.android.com/reference/java/lang/String) | [ARCHIVED](https://developer.android.com/reference/android/provider/Telephony.ThreadsColumns#ARCHIVED) If the thread is archived Type: INTEGER (boolean) <br />                                                                                                                                                                                                      | | [String](https://developer.android.com/reference/java/lang/String) | [DATE](https://developer.android.com/reference/android/provider/Telephony.ThreadsColumns#DATE) The date at which the thread was created.                                                                                                                                                                                                                             | | [String](https://developer.android.com/reference/java/lang/String) | [ERROR](https://developer.android.com/reference/android/provider/Telephony.ThreadsColumns#ERROR) Indicates whether there is a transmission error in the thread.                                                                                                                                                                                                      | | [String](https://developer.android.com/reference/java/lang/String) | [HAS_ATTACHMENT](https://developer.android.com/reference/android/provider/Telephony.ThreadsColumns#HAS_ATTACHMENT) Indicates whether this thread contains any attachments.                                                                                                                                                                                           | | [String](https://developer.android.com/reference/java/lang/String) | [MESSAGE_COUNT](https://developer.android.com/reference/android/provider/Telephony.ThreadsColumns#MESSAGE_COUNT) The message count of the thread.                                                                                                                                                                                                                    | | [String](https://developer.android.com/reference/java/lang/String) | [READ](https://developer.android.com/reference/android/provider/Telephony.ThreadsColumns#READ) Indicates whether all messages of the thread have been read.                                                                                                                                                                                                          | | [String](https://developer.android.com/reference/java/lang/String) | [RECIPIENT_IDS](https://developer.android.com/reference/android/provider/Telephony.ThreadsColumns#RECIPIENT_IDS) A string encoding of the recipient IDs of the recipients of the message, in numerical order and separated by spaces.                                                                                                                                | | [String](https://developer.android.com/reference/java/lang/String) | [SNIPPET](https://developer.android.com/reference/android/provider/Telephony.ThreadsColumns#SNIPPET) The snippet of the latest message in the thread.                                                                                                                                                                                                                | | [String](https://developer.android.com/reference/java/lang/String) | [SNIPPET_CHARSET](https://developer.android.com/reference/android/provider/Telephony.ThreadsColumns#SNIPPET_CHARSET) The charset of the snippet.                                                                                                                                                                                                                     | | [String](https://developer.android.com/reference/java/lang/String) | [TYPE](https://developer.android.com/reference/android/provider/Telephony.ThreadsColumns#TYPE) Type of the thread, either[Threads.COMMON_THREAD](https://developer.android.com/reference/android/provider/Telephony.Threads#COMMON_THREAD)or[Threads.BROADCAST_THREAD](https://developer.android.com/reference/android/provider/Telephony.Threads#BROADCAST_THREAD). | |
| From interface[android.provider.BaseColumns](https://developer.android.com/reference/android/provider/BaseColumns) |--------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------| | [String](https://developer.android.com/reference/java/lang/String) | [_COUNT](https://developer.android.com/reference/android/provider/BaseColumns#_COUNT) The count of rows in a directory. | | [String](https://developer.android.com/reference/java/lang/String) | [_ID](https://developer.android.com/reference/android/provider/BaseColumns#_ID) The unique ID for a row.                |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |

|                                                                                                                                  ### Fields                                                                                                                                   ||
|---------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` public static final `[Uri](https://developer.android.com/reference/android/net/Uri) | [CONTENT_URI](https://developer.android.com/reference/android/provider/Telephony.Threads#CONTENT_URI) The`content://`style URL for this table, by conversation.                        |
| ` public static final `[Uri](https://developer.android.com/reference/android/net/Uri) | [OBSOLETE_THREADS_URI](https://developer.android.com/reference/android/provider/Telephony.Threads#OBSOLETE_THREADS_URI) The`content://`style URL for this table, for obsolete threads. |

|                                                                                                                                                                                                                                       ### Public methods                                                                                                                                                                                                                                       ||
|----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` static long` | ` `[getOrCreateThreadId](https://developer.android.com/reference/android/provider/Telephony.Threads#getOrCreateThreadId(android.content.Context,%20java.lang.String))`(`[Context](https://developer.android.com/reference/android/content/Context)` context, `[String](https://developer.android.com/reference/java/lang/String)` recipient) ` This is a single-recipient version of`getOrCreateThreadId`.                                                                     |
| ` static long` | ` `[getOrCreateThreadId](https://developer.android.com/reference/android/provider/Telephony.Threads#getOrCreateThreadId(android.content.Context,%20java.util.Set<java.lang.String>))`(`[Context](https://developer.android.com/reference/android/content/Context)` context, `[Set](https://developer.android.com/reference/java/util/Set)`<`[String](https://developer.android.com/reference/java/lang/String)`> recipients) ` Given a set of recipients return its thread ID. |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||

## Constants

### BROADCAST_THREAD

Added in[API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int BROADCAST_THREAD
```

Thread type: broadcast thread.

<br />

Constant Value: 1 (0x00000001)  

### COMMON_THREAD

Added in[API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int COMMON_THREAD
```

Thread type: common thread.

<br />

Constant Value: 0 (0x00000000)

## Fields

### CONTENT_URI

Added in[API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final Uri CONTENT_URI
```

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

<br />

### OBSOLETE_THREADS_URI

Added in[API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final Uri OBSOLETE_THREADS_URI
```

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

<br />

## Public methods

### getOrCreateThreadId

Added in[API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static long getOrCreateThreadId (Context context, 
                String recipient)
```

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

<br />

|                        Parameters                         ||
|-------------|----------------------------------------------|
| `context`   | `Context`: the context object to use. <br /> |
| `recipient` | `String`: the recipient to send to. <br />   |

|    Returns     ||
|--------|--------|
| `long` | <br /> |

### getOrCreateThreadId

Added in[API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static long getOrCreateThreadId (Context context, 
                Set<String> recipients)
```

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.

<br />

|           Parameters           ||
|--------------|------------------|
| `context`    | `Context` <br /> |
| `recipients` | `Set` <br />     |

|    Returns     ||
|--------|--------|
| `long` | <br /> |