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

# Telephony.Sms

*** ** * ** ***


`
public
static
final

class
Telephony.Sms
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


implements

https://developer.android.com/reference/android/provider/BaseColumns,

https://developer.android.com/reference/android/provider/Telephony.TextBasedSmsColumns


`

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

<br />

*** ** * ** ***

Contains all text-based SMS messages.


Access to SMS Messages containing an SMS retriever hash (Base64 encoded SHA256 hash of an
app's signing certificate, truncated to 11 characters) is delayed by 3 hours after reception.
However, certain apps are exempt from this delay, and can access these SMS messages
immediately upon receipt, if they hold the READ_SMS permission. These exempted apps are:

1. The default SMS app
2. The default Assistant app
3. The default Dialer app
4. Carrier apps
5. Connected device companion apps
6. System apps
7. Known signer apps
8. The SYSTEM_UI_INTELLIGENCE role holding app

<br />

## Summary

| ### Nested classes ||
|---|---|
| ` class` | `https://developer.android.com/reference/android/provider/Telephony.Sms.Conversations` Contains a view of SMS conversations (also referred to as threads). |
| ` class` | `https://developer.android.com/reference/android/provider/Telephony.Sms.Draft` Contains all draft text-based SMS messages in the SMS app. |
| ` class` | `https://developer.android.com/reference/android/provider/Telephony.Sms.Inbox` Contains all text-based SMS messages in the SMS app inbox. |
| ` class` | `https://developer.android.com/reference/android/provider/Telephony.Sms.Intents` Contains constants for SMS related Intents that are broadcast. |
| ` class` | `https://developer.android.com/reference/android/provider/Telephony.Sms.Outbox` Contains all pending outgoing text-based SMS messages. |
| ` class` | `https://developer.android.com/reference/android/provider/Telephony.Sms.Sent` Contains all sent text-based SMS messages in the SMS app. |

| ### Constants ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/provider/Telephony.Sms#DEFAULT_SORT_ORDER` The default sort order for this table. |

| ### Inherited constants |
|---|
| From interface `https://developer.android.com/reference/android/provider/BaseColumns` |---|---| | `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/provider/BaseColumns#_COUNT` The count of rows in a directory. | | `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/provider/BaseColumns#_ID` The unique ID for a row. | |
| From interface `https://developer.android.com/reference/android/provider/Telephony.TextBasedSmsColumns` |---|---| | `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/provider/Telephony.TextBasedSmsColumns#ADDRESS` The address of the other party. | | `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/provider/Telephony.TextBasedSmsColumns#BODY` The body of the message. | | `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/provider/Telephony.TextBasedSmsColumns#CREATOR` The identity of the sender of a sent message. | | `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/provider/Telephony.TextBasedSmsColumns#DATE` The date the message was received. | | `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/provider/Telephony.TextBasedSmsColumns#DATE_SENT` The date the message was sent. | | `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/provider/Telephony.TextBasedSmsColumns#ERROR_CODE` Error code associated with sending or receiving this message Type: INTEGER <br /> | | `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/provider/Telephony.TextBasedSmsColumns#LOCKED` Is the message locked? Type: INTEGER (boolean) <br /> | | `int` | `https://developer.android.com/reference/android/provider/Telephony.TextBasedSmsColumns#MESSAGE_TYPE_ALL` Message type: all messages. | | `int` | `https://developer.android.com/reference/android/provider/Telephony.TextBasedSmsColumns#MESSAGE_TYPE_DRAFT` Message type: drafts. | | `int` | `https://developer.android.com/reference/android/provider/Telephony.TextBasedSmsColumns#MESSAGE_TYPE_FAILED` Message type: failed outgoing message. | | `int` | `https://developer.android.com/reference/android/provider/Telephony.TextBasedSmsColumns#MESSAGE_TYPE_INBOX` Message type: inbox. | | `int` | `https://developer.android.com/reference/android/provider/Telephony.TextBasedSmsColumns#MESSAGE_TYPE_OUTBOX` Message type: outbox. | | `int` | `https://developer.android.com/reference/android/provider/Telephony.TextBasedSmsColumns#MESSAGE_TYPE_QUEUED` Message type: queued to send later. | | `int` | `https://developer.android.com/reference/android/provider/Telephony.TextBasedSmsColumns#MESSAGE_TYPE_SENT` Message type: sent messages. | | `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/provider/Telephony.TextBasedSmsColumns#PERSON` The ID of the sender of the conversation, if present. | | `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/provider/Telephony.TextBasedSmsColumns#PROTOCOL` The protocol identifier code. | | `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/provider/Telephony.TextBasedSmsColumns#READ` Has the message been read? Type: INTEGER (boolean) <br /> | | `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/provider/Telephony.TextBasedSmsColumns#REPLY_PATH_PRESENT` Is the `TP-Reply-Path` flag set? Type: BOOLEAN <br /> | | `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/provider/Telephony.TextBasedSmsColumns#SEEN` Has the message been seen by the user? The "seen" flag determines whether we need to show a notification. | | `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/provider/Telephony.TextBasedSmsColumns#SERVICE_CENTER` The service center (SC) through which to send the message, if present. | | `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/provider/Telephony.TextBasedSmsColumns#STATUS` `TP-Status` value for the message, or -1 if no status has been received. | | `int` | `https://developer.android.com/reference/android/provider/Telephony.TextBasedSmsColumns#STATUS_COMPLETE` TP-Status: complete. | | `int` | `https://developer.android.com/reference/android/provider/Telephony.TextBasedSmsColumns#STATUS_FAILED` TP-Status: failed. | | `int` | `https://developer.android.com/reference/android/provider/Telephony.TextBasedSmsColumns#STATUS_NONE` TP-Status: no status received. | | `int` | `https://developer.android.com/reference/android/provider/Telephony.TextBasedSmsColumns#STATUS_PENDING` TP-Status: pending. | | `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/provider/Telephony.TextBasedSmsColumns#SUBJECT` The subject of the message, if present. | | `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/provider/Telephony.TextBasedSmsColumns#SUBSCRIPTION_ID` The subscription to which the message belongs to. | | `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/provider/Telephony.TextBasedSmsColumns#THREAD_ID` The thread ID of the message. | | `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/provider/Telephony.TextBasedSmsColumns#TRANSACTION_ID` The `transaction-id` of the message. | | `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/provider/Telephony.TextBasedSmsColumns#TYPE` The type of message. | |

| ### Fields ||
|---|---|
| ` public static final https://developer.android.com/reference/android/net/Uri` | `https://developer.android.com/reference/android/provider/Telephony.Sms#CONTENT_URI` The `content://` style URL for this table. |

| ### Public methods ||
|---|---|
| ` static https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/provider/Telephony.Sms#getDefaultSmsPackage(android.content.Context)(https://developer.android.com/reference/android/content/Context context) ` Used to determine the currently configured default SMS package. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` 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 https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` 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` | ` 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` | ` 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

### DEFAULT_SORT_ORDER

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

```
public static final String DEFAULT_SORT_ORDER
```

The default sort order for this table.

<br />

Constant Value:

"date DESC"


## 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.

<br />

## Public methods

### getDefaultSmsPackage

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

```
public static String getDefaultSmsPackage (Context context)
```

Used to determine the currently configured default SMS package.


As of Android 11 apps will need specific permission to query other packages. To use
this method an app must include in their AndroidManifest:

    <queries>
       <intent>
         <action android:name="android.provider.Telephony.SMS_DELIVER"/>
       </intent>
     </queries>
     
Which will allow them to query packages which declare intent filters that include the `https://developer.android.com/reference/android/provider/Telephony.Sms.Intents#SMS_DELIVER_ACTION` intent.

<br />

<br />

<br />

| Parameters ||
|---|---|
| `context` | `Context`: context of the requesting application <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | package name for the default SMS package or null <br /> |