Added in API level 4

SmsManager


class SmsManager
kotlin.Any
   ↳ android.telephony.SmsManager

Manages SMS operations such as sending data, text, and pdu SMS messages. Get this object by calling the static method getDefault(). To create an instance of SmsManager associated with a specific subscription ID, call getSmsManagerForSubscriptionId(int). This is typically used for devices that support multiple active subscriptions at once.

For information about how to behave as the default SMS app on Android 4.4 (API level 19) and higher, see android.provider.Telephony.
Requires the PackageManager#FEATURE_TELEPHONY_MESSAGING feature which can be detected using PackageManager.hasSystemFeature(String).

Summary

Nested classes
abstract

callback for providing asynchronous sms messages for financial app.

Constants
static String

Intent extra name for MMS sending result data in byte array type

static String

Intent extra name for HTTP status code for MMS HTTP failure in integer type

static String

Whether alias is enabled (boolean type)

static String

Max alias character count (int type)

static String

Min alias character count (int type)

static String

Whether audio is allowed to be attached for MMS messages (boolean type)

static String

Whether to append transaction id to MMS WAP Push M-Notification.

static String

Email gateway number (String type)

static String

Whether group MMS is enabled for the current carrier (boolean type)

static String

A list of HTTP headers to add to MMS HTTP request, separated by "|" (String type)

static String

MMS HTTP socket timeout in milliseconds (int type)

static String

Max MMS image height (int type)

static String

Max MMS image width (int type)

static String

Max MMS message size in bytes (int type)

static String

Max message text size (int type)

static String

Whether MMS delivery report is enabled (boolean type)

static String

Whether MMS is enabled for the current carrier (boolean type)

static String

Whether MMS read report is enabled (boolean type)

static String

Whether multipart SMS is enabled (boolean type)

static String

The suffix to append to the NAI header value for MMS HTTP request (String type)

static String

If this is enabled, M-NotifyResp.

static String

Limit of recipients of MMS messages (int type)

static String

Whether multipart SMS should be sent as separate messages

static String

If true, show the cell broadcast (amber alert) in the SMS settings.

static String

Whether SMS delivery report is enabled (boolean type)

static String

Some carriers require SMS to be converted into MMS when text length reaches this threshold (int type)

static String

When the number of parts of a multipart SMS reaches this threshold, it should be converted into an MMS (int type)

static String

Max message subject length (int type)

static String

Whether the carrier MMSC supports charset field in Content-Type header.

static String

Whether content-disposition field should be expected in an MMS PDU (boolean type)

static String

The name of the UA Prof URL HTTP header for MMS HTTP request (String type)

static String

The UA Profile URL header value for MMS HTTP request (String type)

static String

The User-Agent header value for MMS HTTP request (String type)

static Int

The carrier-dependent configuration values could not be loaded.

static Int

Data is disabled for the MMS APN.

static Int

An error occurred during the HTTP client setup.

static Int

The subscription id for the send/download is inactive.

static Int

ApnException occurred during MMS network setup.

static Int

The subscription id for the send/download is invalid.

static Int

An I/O error occurred reading the PDU.

static Int

MMS is disabled by a carrier.

static Int

There is neither Wi-Fi nor mobile data network.

static Int

An error occurred while retrying sending/downloading the MMS.

static Int

An error occurred during the MMS connection setup.

static Int

Unspecific MMS error occurred during send/download.

static Int

Failed sending via bluetooth because bluetooth disconnected

static Int

Failed because the operation was cancelled

static Int

Failed because of an encoding error

static Int

Failed because FDN is enabled.

static Int

Generic failure cause

static Int

Failed because we reached the sending queue limit.

static Int

No error.

static Int

Failed because service is currently unavailable

static Int

Failed because no pdu provided

static Int

Failed because radio was explicitly turned off

static Int

Failed because the user has denied this app ever send premium short codes.

static Int

Failed because user denied the sending of this short code.

static Int

Failed because of an internal error

static Int

Failed because of invalid arguments

static Int

Failed sending via bluetooth because the bluetooth device address is invalid

static Int

Failed because of an invalid smsc address

static Int

Failed because the sms format is not valid

static Int

Failed because of an invalid state

static Int

Failed because of a modem error

static Int

Failed because of a network error

static Int

Failed because of network rejection

static Int

Failed sending via bluetooth because the bluetooth service is not available

static Int

Set by BroadcastReceiver to indicate there's no default sms app.

static Int

Failed because there is no memory

static Int

Failed because there are no resources

static Int

Failed because the operation is not allowed

static Int

Failed because the radio was not available

static Int

SMS receive dispatch failure.

static Int

SMS receive injected null PDU.

static Int

SMS received null message from the radio interface layer.

static Int

SMS receive encountered runtime exception.

static Int

SMS receive encountered an SQL exception.

static Int

SMS receive an exception parsing a uri.

static Int

SMS short code received while the phone is in encrypted state.

static Int

Set by BroadcastReceiver to indicate a remote exception while handling a message.

static Int

Failed because the request is not supported

static Int

Operation aborted

static Int

Access is barred.

static Int

SMS is blocked due to call control, e.

static Int

The request has been cancelled.

static Int

Operation cannot be performed because the device is currently in use

static Int

The SMS message was not encoded properly.

static Int

A RIL error occurred during the SMS send.

static Int

The modem encountered an unexpected error scenario while handling the request.

static Int

The radio received invalid arguments in the request.

static Int

The radio cannot process the request in the current modem state.

static Int

A RIL internal error when one of the RIL layers receives an unrecognized response from a lower layer.

static Int

Cannot process the request in current SIM state

static Int

The specified SMSC address was invalid.

static Int

The radio returned an error indicating invalid sms format.

static Int

The radio returned an unexpected request for the current state.

static Int

The vendor RIL received an unexpected or incorrect response.

static Int

The radio received an error from the network.

static Int

The network is not ready to perform the request.

static Int

The sms request was rejected by the network.

static Int

The radio didn't have sufficient memory to process the request.

static Int

Network cannot be found

static Int

There are insufficient resources to process the request.

static Int

ACK received when there is no SMS to ack

static Int

Device does not have subscription

static Int

The radio reports the request is not allowed.

static Int

The radio did not start or is resetting.

static Int

The request was not supported by the radio.

static Int

The radio denied the operation due to overly-frequent requests.

static Int

1X voice and SMS are not allowed simultaneously.

static Int

The radio failed to set the location where the CDMA subscription can be retrieved because the SIM or RUIM is absent.

static Int

SIM is busy

static Int

Received error from SIM card

static Int

The target EF is full

static Int

Operation requires SIM PIN2 to be entered

static Int

Operation requires SIM PUK2 to be entered

static Int

The radio failed to send the sms and needs to retry.

static Int

Fail to find CDMA subscription from specified location

static Int

The radio encountered a platform or system error.

static Int

Failed sending during an emergency call

static Int

Failed to send an sms retry

static Int

Failed because of a system error

static Int

Failed sending because the user denied or canceled the dialog displayed for a premium shortcode sms or rate-limited sms.

static Int

User is not associated with the subscription.

static Int

RP-Cause Value for Call Barring

static Int

RP-Cause Value for SMS Failure due to Congestion in network

static Int

RP-Cause Value for Destination is Out of Order

static Int

RP-Cause Value when network does not provide the received service

static Int

RP-Cause Value when SMS Facilty is not subscribed by Reote device

static Int

RP-Cause Value when SMS Facility if Rejected by Operator

static Int

RP-Cause Value when network does not provide the received service

static Int

RP-Cause Value when network does not provide the received service

static Int

RP-Cause Value when network does not provide the received service

static Int

RP-Cause Value when RP-MessageRefere

static Int

RP-Cause Value when network does not provide the received service

static Int

RP-Cause Value when network does not provide the received service

static Int

RP-Cause Value when network is out of order

static Int

RP-Cause for Operator Barring

static Int

RP-Cause Value when network does not provide the received service

static Int

RP-Cause value for Reserved Number

static Int

RP-Cause Value when Network Resources are unavailable

static Int

RP-Cause Value when network does not provide the received service

static Int

RP-Cause Value for Message Transfer Rejected by Network

static Int

RP-Cause Value For Temporary failure

static Int

Unallocated Number Cause

static Int

RP-Cause Value when Subscriber is not Identified

static Int

RP-Cause Value when Subscriber is not Identified

static Int

Free space (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27).

static Int

Received and read (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27).

static Int

Stored and sent (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27).

static Int

Received and unread (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27).

static Int

Stored and unsent (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27).

Public methods
String!

Create a single use app specific incoming SMS request for the calling package.

String?

Create a single use app specific incoming SMS request for the calling package.

SmsManager

Get the instance of the SmsManager associated with a particular subscription ID.

ArrayList<String!>!

Divide a message text into several fragments, none bigger than the maximum SMS message size.

Unit
downloadMultimediaMessage(context: Context!, locationUrl: String!, contentUri: Uri!, configOverrides: Bundle!, downloadedIntent: PendingIntent!)

Download an MMS message from carrier by a given location URL

Unit
downloadMultimediaMessage(context: Context, locationUrl: String, contentUri: Uri, configOverrides: Bundle?, downloadedIntent: PendingIntent?, messageId: Long)

Download an MMS message from carrier by a given location URL Same as downloadMultimediaMessage(android.content.Context,java.lang.String,android.net.Uri,android.os.Bundle,android.app.PendingIntent), but adds an optional messageId.

Bundle

Get carrier-dependent MMS configuration values.

static SmsManager!

Get the SmsManager associated with the default subscription id.

static Int

Get default sms subscription id.

Int

Gets the total capacity of SMS storage on the SIM card.

static SmsManager!

Get the instance of the SmsManager associated with a particular subscription ID.

Unit

Get SMS messages for the calling financial app.

String?

Gets the SMSC address from (U)SIM.

Int

Get the associated subscription id.

Unit
injectSmsPdu(pdu: ByteArray!, format: String!, receivedIntent: PendingIntent!)

Inject an SMS PDU into the android application framework.

Unit
sendDataMessage(destinationAddress: String!, scAddress: String!, destinationPort: Short, data: ByteArray!, sentIntent: PendingIntent!, deliveryIntent: PendingIntent!)

Send a data based SMS to a specific application port.

Unit
sendMultimediaMessage(context: Context!, contentUri: Uri!, locationUrl: String!, configOverrides: Bundle!, sentIntent: PendingIntent!)

Send an MMS message

Unit
sendMultimediaMessage(context: Context, contentUri: Uri, locationUrl: String?, configOverrides: Bundle?, sentIntent: PendingIntent?, messageId: Long)

Send an MMS message Same as sendMultimediaMessage(android.content.Context,android.net.Uri,java.lang.String,android.os.Bundle,android.app.PendingIntent), but adds an optional messageId.

Unit
sendMultipartTextMessage(destinationAddress: String!, scAddress: String!, parts: ArrayList<String!>!, sentIntents: ArrayList<PendingIntent!>!, deliveryIntents: ArrayList<PendingIntent!>!)

Send a multi-part text based SMS.

Unit
sendMultipartTextMessage(destinationAddress: String, scAddress: String?, parts: MutableList<String!>, sentIntents: MutableList<PendingIntent!>?, deliveryIntents: MutableList<PendingIntent!>?, messageId: Long)

Send a multi-part text based SMS.

Unit
sendMultipartTextMessage(destinationAddress: String, scAddress: String?, parts: MutableList<String!>, sentIntents: MutableList<PendingIntent!>?, deliveryIntents: MutableList<PendingIntent!>?, packageName: String, attributionTag: String?)

Similar method as #sendMultipartTextMessage(String, String, ArrayList, ArrayList, ArrayList) With an additional argument.

Unit
sendTextMessage(destinationAddress: String!, scAddress: String!, text: String!, sentIntent: PendingIntent!, deliveryIntent: PendingIntent!)

Send a text based SMS.

Unit
sendTextMessage(destinationAddress: String, scAddress: String?, text: String, sentIntent: PendingIntent?, deliveryIntent: PendingIntent?, messageId: Long)

Send a text based SMS.

Unit
sendTextMessageWithoutPersisting(destinationAddress: String!, scAddress: String!, text: String!, sentIntent: PendingIntent!, deliveryIntent: PendingIntent!)

Send a text based SMS without writing it into the SMS Provider.

Boolean

Sets the SMSC address on (U)SIM.

Constants

EXTRA_MMS_DATA

Added in API level 21
static val EXTRA_MMS_DATA: String

Intent extra name for MMS sending result data in byte array type

Value: "android.telephony.extra.MMS_DATA"

EXTRA_MMS_HTTP_STATUS

Added in API level 22
static val EXTRA_MMS_HTTP_STATUS: String

Intent extra name for HTTP status code for MMS HTTP failure in integer type

Value: "android.telephony.extra.MMS_HTTP_STATUS"

MMS_CONFIG_ALIAS_ENABLED

Added in API level 21
static val MMS_CONFIG_ALIAS_ENABLED: String

Whether alias is enabled (boolean type)

Value: "aliasEnabled"

MMS_CONFIG_ALIAS_MAX_CHARS

Added in API level 21
static val MMS_CONFIG_ALIAS_MAX_CHARS: String

Max alias character count (int type)

Value: "aliasMaxChars"

MMS_CONFIG_ALIAS_MIN_CHARS

Added in API level 21
static val MMS_CONFIG_ALIAS_MIN_CHARS: String

Min alias character count (int type)

Value: "aliasMinChars"

MMS_CONFIG_ALLOW_ATTACH_AUDIO

Added in API level 21
static val MMS_CONFIG_ALLOW_ATTACH_AUDIO: String

Whether audio is allowed to be attached for MMS messages (boolean type)

Value: "allowAttachAudio"

MMS_CONFIG_APPEND_TRANSACTION_ID

Added in API level 21
static val MMS_CONFIG_APPEND_TRANSACTION_ID: String

Whether to append transaction id to MMS WAP Push M-Notification.ind's content location URI when constructing the download URL of a new MMS (boolean type)

Value: "enabledTransID"

MMS_CONFIG_EMAIL_GATEWAY_NUMBER

Added in API level 21
static val MMS_CONFIG_EMAIL_GATEWAY_NUMBER: String

Email gateway number (String type)

Value: "emailGatewayNumber"

MMS_CONFIG_GROUP_MMS_ENABLED

Added in API level 21
static val MMS_CONFIG_GROUP_MMS_ENABLED: String

Whether group MMS is enabled for the current carrier (boolean type)

Value: "enableGroupMms"

MMS_CONFIG_HTTP_PARAMS

Added in API level 21
static val MMS_CONFIG_HTTP_PARAMS: String

A list of HTTP headers to add to MMS HTTP request, separated by "|" (String type)

Value: "httpParams"

MMS_CONFIG_HTTP_SOCKET_TIMEOUT

Added in API level 21
static val MMS_CONFIG_HTTP_SOCKET_TIMEOUT: String

MMS HTTP socket timeout in milliseconds (int type)

Value: "httpSocketTimeout"

MMS_CONFIG_MAX_IMAGE_HEIGHT

Added in API level 21
static val MMS_CONFIG_MAX_IMAGE_HEIGHT: String

Max MMS image height (int type)

Value: "maxImageHeight"

MMS_CONFIG_MAX_IMAGE_WIDTH

Added in API level 21
static val MMS_CONFIG_MAX_IMAGE_WIDTH: String

Max MMS image width (int type)

Value: "maxImageWidth"

MMS_CONFIG_MAX_MESSAGE_SIZE

Added in API level 21
static val MMS_CONFIG_MAX_MESSAGE_SIZE: String

Max MMS message size in bytes (int type)

Value: "maxMessageSize"

MMS_CONFIG_MESSAGE_TEXT_MAX_SIZE

Added in API level 21
static val MMS_CONFIG_MESSAGE_TEXT_MAX_SIZE: String

Max message text size (int type)

Value: "maxMessageTextSize"

MMS_CONFIG_MMS_DELIVERY_REPORT_ENABLED

Added in API level 21
static val MMS_CONFIG_MMS_DELIVERY_REPORT_ENABLED: String

Whether MMS delivery report is enabled (boolean type)

Value: "enableMMSDeliveryReports"

MMS_CONFIG_MMS_ENABLED

Added in API level 21
static val MMS_CONFIG_MMS_ENABLED: String

Whether MMS is enabled for the current carrier (boolean type)

Value: "enabledMMS"

MMS_CONFIG_MMS_READ_REPORT_ENABLED

Added in API level 21
static val MMS_CONFIG_MMS_READ_REPORT_ENABLED: String

Whether MMS read report is enabled (boolean type)

Value: "enableMMSReadReports"

MMS_CONFIG_MULTIPART_SMS_ENABLED

Added in API level 21
static val MMS_CONFIG_MULTIPART_SMS_ENABLED: String

Whether multipart SMS is enabled (boolean type)

Value: "enableMultipartSMS"

MMS_CONFIG_NAI_SUFFIX

Added in API level 21
static val MMS_CONFIG_NAI_SUFFIX: String

The suffix to append to the NAI header value for MMS HTTP request (String type)

Value: "naiSuffix"

MMS_CONFIG_NOTIFY_WAP_MMSC_ENABLED

Added in API level 21
static val MMS_CONFIG_NOTIFY_WAP_MMSC_ENABLED: String

If this is enabled, M-NotifyResp.ind should be sent to the WAP Push content location instead of the default MMSC (boolean type)

Value: "enabledNotifyWapMMSC"

MMS_CONFIG_RECIPIENT_LIMIT

Added in API level 21
static val MMS_CONFIG_RECIPIENT_LIMIT: String

Limit of recipients of MMS messages (int type)

Value: "recipientLimit"

MMS_CONFIG_SEND_MULTIPART_SMS_AS_SEPARATE_MESSAGES

Added in API level 21
static val MMS_CONFIG_SEND_MULTIPART_SMS_AS_SEPARATE_MESSAGES: String

Whether multipart SMS should be sent as separate messages

Value: "sendMultipartSmsAsSeparateMessages"
Added in API level 22
static val MMS_CONFIG_SHOW_CELL_BROADCAST_APP_LINKS: String

If true, show the cell broadcast (amber alert) in the SMS settings. Some carriers don't want this shown. (Boolean type)

Value: "config_cellBroadcastAppLinks"

MMS_CONFIG_SMS_DELIVERY_REPORT_ENABLED

Added in API level 21
static val MMS_CONFIG_SMS_DELIVERY_REPORT_ENABLED: String

Whether SMS delivery report is enabled (boolean type)

Value: "enableSMSDeliveryReports"

MMS_CONFIG_SMS_TO_MMS_TEXT_LENGTH_THRESHOLD

Added in API level 21
static val MMS_CONFIG_SMS_TO_MMS_TEXT_LENGTH_THRESHOLD: String

Some carriers require SMS to be converted into MMS when text length reaches this threshold (int type)

Value: "smsToMmsTextLengthThreshold"

MMS_CONFIG_SMS_TO_MMS_TEXT_THRESHOLD

Added in API level 21
static val MMS_CONFIG_SMS_TO_MMS_TEXT_THRESHOLD: String

When the number of parts of a multipart SMS reaches this threshold, it should be converted into an MMS (int type)

Value: "smsToMmsTextThreshold"

MMS_CONFIG_SUBJECT_MAX_LENGTH

Added in API level 21
static val MMS_CONFIG_SUBJECT_MAX_LENGTH: String

Max message subject length (int type)

Value: "maxSubjectLength"

MMS_CONFIG_SUPPORT_HTTP_CHARSET_HEADER

Added in API level 23
static val MMS_CONFIG_SUPPORT_HTTP_CHARSET_HEADER: String

Whether the carrier MMSC supports charset field in Content-Type header. If this is false, then we don't add "charset" to "Content-Type"

Value: "supportHttpCharsetHeader"

MMS_CONFIG_SUPPORT_MMS_CONTENT_DISPOSITION

Added in API level 21
static val MMS_CONFIG_SUPPORT_MMS_CONTENT_DISPOSITION: String

Whether content-disposition field should be expected in an MMS PDU (boolean type)

Value: "supportMmsContentDisposition"

MMS_CONFIG_UA_PROF_TAG_NAME

Added in API level 21
static val MMS_CONFIG_UA_PROF_TAG_NAME: String

The name of the UA Prof URL HTTP header for MMS HTTP request (String type)

Value: "uaProfTagName"

MMS_CONFIG_UA_PROF_URL

Added in API level 21
static val MMS_CONFIG_UA_PROF_URL: String

The UA Profile URL header value for MMS HTTP request (String type)

Value: "uaProfUrl"

MMS_CONFIG_USER_AGENT

Added in API level 21
static val MMS_CONFIG_USER_AGENT: String

The User-Agent header value for MMS HTTP request (String type)

Value: "userAgent"

MMS_ERROR_CONFIGURATION_ERROR

Added in API level 21
static val MMS_ERROR_CONFIGURATION_ERROR: Int

The carrier-dependent configuration values could not be loaded.

Value: 7

MMS_ERROR_DATA_DISABLED

Added in API level 33
static val MMS_ERROR_DATA_DISABLED: Int

Data is disabled for the MMS APN.

Value: 11

MMS_ERROR_HTTP_FAILURE

Added in API level 21
static val MMS_ERROR_HTTP_FAILURE: Int

An error occurred during the HTTP client setup.

Value: 4

MMS_ERROR_INACTIVE_SUBSCRIPTION

Added in API level 33
static val MMS_ERROR_INACTIVE_SUBSCRIPTION: Int

The subscription id for the send/download is inactive.

Value: 10

MMS_ERROR_INVALID_APN

Added in API level 21
static val MMS_ERROR_INVALID_APN: Int

ApnException occurred during MMS network setup.

Value: 2

MMS_ERROR_INVALID_SUBSCRIPTION_ID

Added in API level 33
static val MMS_ERROR_INVALID_SUBSCRIPTION_ID: Int

The subscription id for the send/download is invalid.

Value: 9

MMS_ERROR_IO_ERROR

Added in API level 21
static val MMS_ERROR_IO_ERROR: Int

An I/O error occurred reading the PDU.

Value: 5

MMS_ERROR_MMS_DISABLED_BY_CARRIER

Added in API level 35
static val MMS_ERROR_MMS_DISABLED_BY_CARRIER: Int

MMS is disabled by a carrier.

Value: 12

MMS_ERROR_NO_DATA_NETWORK

Added in API level 22
static val MMS_ERROR_NO_DATA_NETWORK: Int

There is neither Wi-Fi nor mobile data network.

Value: 8

MMS_ERROR_RETRY

Added in API level 21
static val MMS_ERROR_RETRY: Int

An error occurred while retrying sending/downloading the MMS.

Value: 6

MMS_ERROR_UNABLE_CONNECT_MMS

Added in API level 21
static val MMS_ERROR_UNABLE_CONNECT_MMS: Int

An error occurred during the MMS connection setup.

Value: 3

MMS_ERROR_UNSPECIFIED

Added in API level 21
static val MMS_ERROR_UNSPECIFIED: Int

Unspecific MMS error occurred during send/download.

Value: 1

RESULT_BLUETOOTH_DISCONNECTED

Added in API level 30
static val RESULT_BLUETOOTH_DISCONNECTED: Int

Failed sending via bluetooth because bluetooth disconnected

Value: 27

RESULT_CANCELLED

Added in API level 30
static val RESULT_CANCELLED: Int

Failed because the operation was cancelled

Value: 23

RESULT_ENCODING_ERROR

Added in API level 30
static val RESULT_ENCODING_ERROR: Int

Failed because of an encoding error

Value: 18

RESULT_ERROR_FDN_CHECK_FAILURE

Added in API level 30
static val RESULT_ERROR_FDN_CHECK_FAILURE: Int

Failed because FDN is enabled.

Value: 6

RESULT_ERROR_GENERIC_FAILURE

Added in API level 4
static val RESULT_ERROR_GENERIC_FAILURE: Int

Generic failure cause

Value: 1

RESULT_ERROR_LIMIT_EXCEEDED

Added in API level 27
static val RESULT_ERROR_LIMIT_EXCEEDED: Int

Failed because we reached the sending queue limit.

Value: 5

RESULT_ERROR_NONE

Added in API level 30
static val RESULT_ERROR_NONE: Int

No error.

Value: 0

RESULT_ERROR_NO_SERVICE

Added in API level 4
static val RESULT_ERROR_NO_SERVICE: Int

Failed because service is currently unavailable

Value: 4

RESULT_ERROR_NULL_PDU

Added in API level 4
static val RESULT_ERROR_NULL_PDU: Int

Failed because no pdu provided

Value: 3

RESULT_ERROR_RADIO_OFF

Added in API level 4
static val RESULT_ERROR_RADIO_OFF: Int

Failed because radio was explicitly turned off

Value: 2

RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED

Added in API level 27
static val RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED: Int

Failed because the user has denied this app ever send premium short codes.

Value: 8

RESULT_ERROR_SHORT_CODE_NOT_ALLOWED

Added in API level 27
static val RESULT_ERROR_SHORT_CODE_NOT_ALLOWED: Int

Failed because user denied the sending of this short code.

Value: 7

RESULT_INTERNAL_ERROR

Added in API level 30
static val RESULT_INTERNAL_ERROR: Int

Failed because of an internal error

Value: 21

RESULT_INVALID_ARGUMENTS

Added in API level 30
static val RESULT_INVALID_ARGUMENTS: Int

Failed because of invalid arguments

Value: 11

RESULT_INVALID_BLUETOOTH_ADDRESS

Added in API level 30
static val RESULT_INVALID_BLUETOOTH_ADDRESS: Int

Failed sending via bluetooth because the bluetooth device address is invalid

Value: 26

RESULT_INVALID_SMSC_ADDRESS

Added in API level 30
static val RESULT_INVALID_SMSC_ADDRESS: Int

Failed because of an invalid smsc address

Value: 19

RESULT_INVALID_SMS_FORMAT

Added in API level 30
static val RESULT_INVALID_SMS_FORMAT: Int

Failed because the sms format is not valid

Value: 14

RESULT_INVALID_STATE

Added in API level 30
static val RESULT_INVALID_STATE: Int

Failed because of an invalid state

Value: 12

RESULT_MODEM_ERROR

Added in API level 30
static val RESULT_MODEM_ERROR: Int

Failed because of a modem error

Value: 16

RESULT_NETWORK_ERROR

Added in API level 30
static val RESULT_NETWORK_ERROR: Int

Failed because of a network error

Value: 17

RESULT_NETWORK_REJECT

Added in API level 30
static val RESULT_NETWORK_REJECT: Int

Failed because of network rejection

Value: 10

RESULT_NO_BLUETOOTH_SERVICE

Added in API level 30
static val RESULT_NO_BLUETOOTH_SERVICE: Int

Failed sending via bluetooth because the bluetooth service is not available

Value: 25

RESULT_NO_DEFAULT_SMS_APP

Added in API level 30
static val RESULT_NO_DEFAULT_SMS_APP: Int

Set by BroadcastReceiver to indicate there's no default sms app.

Value: 32

RESULT_NO_MEMORY

Added in API level 30
static val RESULT_NO_MEMORY: Int

Failed because there is no memory

Value: 13

RESULT_NO_RESOURCES

Added in API level 30
static val RESULT_NO_RESOURCES: Int

Failed because there are no resources

Value: 22

RESULT_OPERATION_NOT_ALLOWED

Added in API level 30
static val RESULT_OPERATION_NOT_ALLOWED: Int

Failed because the operation is not allowed

Value: 20

RESULT_RADIO_NOT_AVAILABLE

Added in API level 30
static val RESULT_RADIO_NOT_AVAILABLE: Int

Failed because the radio was not available

Value: 9

RESULT_RECEIVE_DISPATCH_FAILURE

Added in API level 30
static val RESULT_RECEIVE_DISPATCH_FAILURE: Int

SMS receive dispatch failure.

Value: 500

RESULT_RECEIVE_INJECTED_NULL_PDU

Added in API level 30
static val RESULT_RECEIVE_INJECTED_NULL_PDU: Int

SMS receive injected null PDU.

Value: 501

RESULT_RECEIVE_NULL_MESSAGE_FROM_RIL

Added in API level 30
static val RESULT_RECEIVE_NULL_MESSAGE_FROM_RIL: Int

SMS received null message from the radio interface layer.

Value: 503

RESULT_RECEIVE_RUNTIME_EXCEPTION

Added in API level 30
static val RESULT_RECEIVE_RUNTIME_EXCEPTION: Int

SMS receive encountered runtime exception.

Value: 502

RESULT_RECEIVE_SQL_EXCEPTION

Added in API level 30
static val RESULT_RECEIVE_SQL_EXCEPTION: Int

SMS receive encountered an SQL exception.

Value: 505

RESULT_RECEIVE_URI_EXCEPTION

Added in API level 30
static val RESULT_RECEIVE_URI_EXCEPTION: Int

SMS receive an exception parsing a uri.

Value: 506

RESULT_RECEIVE_WHILE_ENCRYPTED

Added in API level 30
static val RESULT_RECEIVE_WHILE_ENCRYPTED: Int

SMS short code received while the phone is in encrypted state.

Value: 504

RESULT_REMOTE_EXCEPTION

Added in API level 30
static val RESULT_REMOTE_EXCEPTION: Int

Set by BroadcastReceiver to indicate a remote exception while handling a message.

Value: 31

RESULT_REQUEST_NOT_SUPPORTED

Added in API level 30
static val RESULT_REQUEST_NOT_SUPPORTED: Int

Failed because the request is not supported

Value: 24

RESULT_RIL_ABORTED

Added in API level 34
static val RESULT_RIL_ABORTED: Int

Operation aborted

Value: 137

RESULT_RIL_ACCESS_BARRED

Added in API level 31
static val RESULT_RIL_ACCESS_BARRED: Int

Access is barred.

Value: 122

RESULT_RIL_BLOCKED_DUE_TO_CALL

Added in API level 31
static val RESULT_RIL_BLOCKED_DUE_TO_CALL: Int

SMS is blocked due to call control, e.g., resource unavailable in the SMR entity.

Value: 123

RESULT_RIL_CANCELLED

Added in API level 30
static val RESULT_RIL_CANCELLED: Int

The request has been cancelled.

Value: 119

RESULT_RIL_DEVICE_IN_USE

Added in API level 34
static val RESULT_RIL_DEVICE_IN_USE: Int

Operation cannot be performed because the device is currently in use

Value: 136

RESULT_RIL_ENCODING_ERR

Added in API level 30
static val RESULT_RIL_ENCODING_ERR: Int

The SMS message was not encoded properly.

Value: 109

RESULT_RIL_GENERIC_ERROR

Added in API level 33
static val RESULT_RIL_GENERIC_ERROR: Int

A RIL error occurred during the SMS send.

Value: 124

RESULT_RIL_INTERNAL_ERR

Added in API level 30
static val RESULT_RIL_INTERNAL_ERR: Int

The modem encountered an unexpected error scenario while handling the request.

Value: 113

RESULT_RIL_INVALID_ARGUMENTS

Added in API level 30
static val RESULT_RIL_INVALID_ARGUMENTS: Int

The radio received invalid arguments in the request.

Value: 104

RESULT_RIL_INVALID_MODEM_STATE

Added in API level 30
static val RESULT_RIL_INVALID_MODEM_STATE: Int

The radio cannot process the request in the current modem state.

Value: 115

RESULT_RIL_INVALID_RESPONSE

Added in API level 34
static val RESULT_RIL_INVALID_RESPONSE: Int

A RIL internal error when one of the RIL layers receives an unrecognized response from a lower layer.

Value: 125

RESULT_RIL_INVALID_SIM_STATE

Added in API level 34
static val RESULT_RIL_INVALID_SIM_STATE: Int

Cannot process the request in current SIM state

Value: 130

RESULT_RIL_INVALID_SMSC_ADDRESS

Added in API level 30
static val RESULT_RIL_INVALID_SMSC_ADDRESS: Int

The specified SMSC address was invalid.

Value: 110

RESULT_RIL_INVALID_SMS_FORMAT

Added in API level 30
static val RESULT_RIL_INVALID_SMS_FORMAT: Int

The radio returned an error indicating invalid sms format.

Value: 107

RESULT_RIL_INVALID_STATE

Added in API level 30
static val RESULT_RIL_INVALID_STATE: Int

The radio returned an unexpected request for the current state.

Value: 103

RESULT_RIL_MODEM_ERR

Added in API level 30
static val RESULT_RIL_MODEM_ERR: Int

The vendor RIL received an unexpected or incorrect response.

Value: 111

RESULT_RIL_NETWORK_ERR

Added in API level 30
static val RESULT_RIL_NETWORK_ERR: Int

The radio received an error from the network.

Value: 112

RESULT_RIL_NETWORK_NOT_READY

Added in API level 30
static val RESULT_RIL_NETWORK_NOT_READY: Int

The network is not ready to perform the request.

Value: 116

RESULT_RIL_NETWORK_REJECT

Added in API level 30
static val RESULT_RIL_NETWORK_REJECT: Int

The sms request was rejected by the network.

Value: 102

RESULT_RIL_NO_MEMORY

Added in API level 30
static val RESULT_RIL_NO_MEMORY: Int

The radio didn't have sufficient memory to process the request.

Value: 105

RESULT_RIL_NO_NETWORK_FOUND

Added in API level 34
static val RESULT_RIL_NO_NETWORK_FOUND: Int

Network cannot be found

Value: 135

RESULT_RIL_NO_RESOURCES

Added in API level 30
static val RESULT_RIL_NO_RESOURCES: Int

There are insufficient resources to process the request.

Value: 118

RESULT_RIL_NO_SMS_TO_ACK

Added in API level 34
static val RESULT_RIL_NO_SMS_TO_ACK: Int

ACK received when there is no SMS to ack

Value: 131

RESULT_RIL_NO_SUBSCRIPTION

Added in API level 34
static val RESULT_RIL_NO_SUBSCRIPTION: Int

Device does not have subscription

Value: 134

RESULT_RIL_OPERATION_NOT_ALLOWED

Added in API level 30
static val RESULT_RIL_OPERATION_NOT_ALLOWED: Int

The radio reports the request is not allowed.

Value: 117

RESULT_RIL_RADIO_NOT_AVAILABLE

Added in API level 30
static val RESULT_RIL_RADIO_NOT_AVAILABLE: Int

The radio did not start or is resetting.

Value: 100

RESULT_RIL_REQUEST_NOT_SUPPORTED

Added in API level 30
static val RESULT_RIL_REQUEST_NOT_SUPPORTED: Int

The request was not supported by the radio.

Value: 114

RESULT_RIL_REQUEST_RATE_LIMITED

Added in API level 30
static val RESULT_RIL_REQUEST_RATE_LIMITED: Int

The radio denied the operation due to overly-frequent requests.

Value: 106

RESULT_RIL_SIMULTANEOUS_SMS_AND_CALL_NOT_ALLOWED

Added in API level 31
static val RESULT_RIL_SIMULTANEOUS_SMS_AND_CALL_NOT_ALLOWED: Int

1X voice and SMS are not allowed simultaneously.

Value: 121

RESULT_RIL_SIM_ABSENT

Added in API level 30
static val RESULT_RIL_SIM_ABSENT: Int

The radio failed to set the location where the CDMA subscription can be retrieved because the SIM or RUIM is absent.

Value: 120

RESULT_RIL_SIM_BUSY

Added in API level 34
static val RESULT_RIL_SIM_BUSY: Int

SIM is busy

Value: 132

RESULT_RIL_SIM_ERROR

Added in API level 34
static val RESULT_RIL_SIM_ERROR: Int

Received error from SIM card

Value: 129

RESULT_RIL_SIM_FULL

Added in API level 34
static val RESULT_RIL_SIM_FULL: Int

The target EF is full

Value: 133

RESULT_RIL_SIM_PIN2

Added in API level 34
static val RESULT_RIL_SIM_PIN2: Int

Operation requires SIM PIN2 to be entered

Value: 126

RESULT_RIL_SIM_PUK2

Added in API level 34
static val RESULT_RIL_SIM_PUK2: Int

Operation requires SIM PUK2 to be entered

Value: 127

RESULT_RIL_SMS_SEND_FAIL_RETRY

Added in API level 30
static val RESULT_RIL_SMS_SEND_FAIL_RETRY: Int

The radio failed to send the sms and needs to retry.

Value: 101

RESULT_RIL_SUBSCRIPTION_NOT_AVAILABLE

Added in API level 34
static val RESULT_RIL_SUBSCRIPTION_NOT_AVAILABLE: Int

Fail to find CDMA subscription from specified location

Value: 128

RESULT_RIL_SYSTEM_ERR

Added in API level 30
static val RESULT_RIL_SYSTEM_ERR: Int

The radio encountered a platform or system error.

Value: 108

RESULT_SMS_BLOCKED_DURING_EMERGENCY

Added in API level 30
static val RESULT_SMS_BLOCKED_DURING_EMERGENCY: Int

Failed sending during an emergency call

Value: 29

RESULT_SMS_SEND_RETRY_FAILED

Added in API level 30
static val RESULT_SMS_SEND_RETRY_FAILED: Int

Failed to send an sms retry

Value: 30

RESULT_SYSTEM_ERROR

Added in API level 30
static val RESULT_SYSTEM_ERROR: Int

Failed because of a system error

Value: 15

RESULT_UNEXPECTED_EVENT_STOP_SENDING

Added in API level 30
static val RESULT_UNEXPECTED_EVENT_STOP_SENDING: Int

Failed sending because the user denied or canceled the dialog displayed for a premium shortcode sms or rate-limited sms.

Value: 28

RESULT_USER_NOT_ALLOWED

Added in API level 34
static val RESULT_USER_NOT_ALLOWED: Int

User is not associated with the subscription.

Value: 33

SMS_RP_CAUSE_CALL_BARRING

Added in API level 34
static val SMS_RP_CAUSE_CALL_BARRING: Int

RP-Cause Value for Call Barring

Value: 10

SMS_RP_CAUSE_CONGESTION

Added in API level 34
static val SMS_RP_CAUSE_CONGESTION: Int

RP-Cause Value for SMS Failure due to Congestion in network

Value: 42

SMS_RP_CAUSE_DESTINATION_OUT_OF_ORDER

Added in API level 34
static val SMS_RP_CAUSE_DESTINATION_OUT_OF_ORDER: Int

RP-Cause Value for Destination is Out of Order

Value: 27

SMS_RP_CAUSE_FACILITY_NOT_IMPLEMENTED

Added in API level 34
static val SMS_RP_CAUSE_FACILITY_NOT_IMPLEMENTED: Int

RP-Cause Value when network does not provide the received service

Value: 69

SMS_RP_CAUSE_FACILITY_NOT_SUBSCRIBED

Added in API level 34
static val SMS_RP_CAUSE_FACILITY_NOT_SUBSCRIBED: Int

RP-Cause Value when SMS Facilty is not subscribed by Reote device

Value: 50

SMS_RP_CAUSE_FACILITY_REJECTED

Added in API level 34
static val SMS_RP_CAUSE_FACILITY_REJECTED: Int

RP-Cause Value when SMS Facility if Rejected by Operator

Value: 29

SMS_RP_CAUSE_INFORMATION_ELEMENT_NON_EXISTENT

Added in API level 34
static val SMS_RP_CAUSE_INFORMATION_ELEMENT_NON_EXISTENT: Int

RP-Cause Value when network does not provide the received service

Value: 99

SMS_RP_CAUSE_INTERWORKING_UNSPECIFIED

Added in API level 34
static val SMS_RP_CAUSE_INTERWORKING_UNSPECIFIED: Int

RP-Cause Value when network does not provide the received service

Value: 127

SMS_RP_CAUSE_INVALID_MANDATORY_INFORMATION

Added in API level 34
static val SMS_RP_CAUSE_INVALID_MANDATORY_INFORMATION: Int

RP-Cause Value when network does not provide the received service

Value: 96

SMS_RP_CAUSE_INVALID_MESSAGE_REFERENCE_VALUE

Added in API level 34
static val SMS_RP_CAUSE_INVALID_MESSAGE_REFERENCE_VALUE: Int

RP-Cause Value when RP-MessageRefere

Value: 81

SMS_RP_CAUSE_MESSAGE_INCOMPATIBLE_WITH_PROTOCOL_STATE

Added in API level 34
static val SMS_RP_CAUSE_MESSAGE_INCOMPATIBLE_WITH_PROTOCOL_STATE: Int

RP-Cause Value when network does not provide the received service

Value: 98

SMS_RP_CAUSE_MESSAGE_TYPE_NON_EXISTENT

Added in API level 34
static val SMS_RP_CAUSE_MESSAGE_TYPE_NON_EXISTENT: Int

RP-Cause Value when network does not provide the received service

Value: 97

SMS_RP_CAUSE_NETWORK_OUT_OF_ORDER

Added in API level 34
static val SMS_RP_CAUSE_NETWORK_OUT_OF_ORDER: Int

RP-Cause Value when network is out of order

Value: 38

SMS_RP_CAUSE_OPERATOR_DETERMINED_BARRING

Added in API level 34
static val SMS_RP_CAUSE_OPERATOR_DETERMINED_BARRING: Int

RP-Cause for Operator Barring

Value: 8

SMS_RP_CAUSE_PROTOCOL_ERROR

Added in API level 34
static val SMS_RP_CAUSE_PROTOCOL_ERROR: Int

RP-Cause Value when network does not provide the received service

Value: 111

SMS_RP_CAUSE_RESERVED

Added in API level 34
static val SMS_RP_CAUSE_RESERVED: Int

RP-Cause value for Reserved Number

Value: 11

SMS_RP_CAUSE_RESOURCES_UNAVAILABLE

Added in API level 34
static val SMS_RP_CAUSE_RESOURCES_UNAVAILABLE: Int

RP-Cause Value when Network Resources are unavailable

Value: 47

SMS_RP_CAUSE_SEMANTICALLY_INCORRECT_MESSAGE

Added in API level 34
static val SMS_RP_CAUSE_SEMANTICALLY_INCORRECT_MESSAGE: Int

RP-Cause Value when network does not provide the received service

Value: 95

SMS_RP_CAUSE_SHORT_MESSAGE_TRANSFER_REJECTED

Added in API level 34
static val SMS_RP_CAUSE_SHORT_MESSAGE_TRANSFER_REJECTED: Int

RP-Cause Value for Message Transfer Rejected by Network

Value: 21

SMS_RP_CAUSE_TEMPORARY_FAILURE

Added in API level 34
static val SMS_RP_CAUSE_TEMPORARY_FAILURE: Int

RP-Cause Value For Temporary failure

Value: 41

SMS_RP_CAUSE_UNALLOCATED_NUMBER

Added in API level 34
static val SMS_RP_CAUSE_UNALLOCATED_NUMBER: Int

Unallocated Number Cause

Value: 1

SMS_RP_CAUSE_UNIDENTIFIED_SUBSCRIBER

Added in API level 34
static val SMS_RP_CAUSE_UNIDENTIFIED_SUBSCRIBER: Int

RP-Cause Value when Subscriber is not Identified

Value: 28

SMS_RP_CAUSE_UNKNOWN_SUBSCRIBER

Added in API level 34
static val SMS_RP_CAUSE_UNKNOWN_SUBSCRIBER: Int

RP-Cause Value when Subscriber is not Identified

Value: 30

STATUS_ON_ICC_FREE

Added in API level 4
static val STATUS_ON_ICC_FREE: Int

Free space (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27).

Value: 0

STATUS_ON_ICC_READ

Added in API level 4
static val STATUS_ON_ICC_READ: Int

Received and read (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27).

Value: 1

STATUS_ON_ICC_SENT

Added in API level 4
static val STATUS_ON_ICC_SENT: Int

Stored and sent (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27).

Value: 5

STATUS_ON_ICC_UNREAD

Added in API level 4
static val STATUS_ON_ICC_UNREAD: Int

Received and unread (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27).

Value: 3

STATUS_ON_ICC_UNSENT

Added in API level 4
static val STATUS_ON_ICC_UNSENT: Int

Stored and unsent (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27).

Value: 7

Public methods

createAppSpecificSmsToken

Added in API level 26
fun createAppSpecificSmsToken(intent: PendingIntent!): String!

Create a single use app specific incoming SMS request for the calling package. This method returns a token that if included in a subsequent incoming SMS message will cause intent to be sent with the SMS data. The token is only good for one use, after an SMS has been received containing the token all subsequent SMS messages with the token will be routed as normal. An app can only have one request at a time, if the app already has a request pending it will be replaced with a new request.

Note: This method will never trigger an SMS disambiguation dialog. If this method is called on a device that has multiple active subscriptions, this SmsManager instance has been created with getDefault(), and no user-defined default subscription is defined, the subscription ID associated with this message will be INVALID, which will result in the operation being completed on the subscription associated with logical slot 0. Use getSmsManagerForSubscriptionId(int) to ensure the operation is performed on the correct subscription.


Requires the PackageManager#FEATURE_TELEPHONY_MESSAGING feature which can be detected using PackageManager.hasSystemFeature(String).
Return
String! Token to include in an SMS message. The token will be 11 characters long.
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_MESSAGING.

createAppSpecificSmsTokenWithPackageInfo

Added in API level 29
fun createAppSpecificSmsTokenWithPackageInfo(
    prefixes: String?,
    intent: PendingIntent
): String?

Create a single use app specific incoming SMS request for the calling package. This method returns a token that if included in a subsequent incoming SMS message, and the SMS message has a prefix from the given prefixes list, the provided intent will be sent with the SMS data to the calling package. The token is only good for one use within a reasonable amount of time. After an SMS has been received containing the token all subsequent SMS messages with the token will be routed as normal. An app can only have one request at a time, if the app already has a request pending it will be replaced with a new request.

Note: This method will never trigger an SMS disambiguation dialog. If this method is called on a device that has multiple active subscriptions, this SmsManager instance has been created with getDefault(), and no user-defined default subscription is defined, the subscription ID associated with this message will be INVALID, which will result in the operation being completed on the subscription associated with logical slot 0. Use getSmsManagerForSubscriptionId(int) to ensure the operation is performed on the correct subscription.


Requires the PackageManager#FEATURE_TELEPHONY_MESSAGING feature which can be detected using PackageManager.hasSystemFeature(String).
Parameters
prefixes String?: this is a list of prefixes string separated by REGEX_PREFIX_DELIMITER. The matching SMS message should have at least one of the prefixes in the beginning of the message. This value may be null.
intent PendingIntent: this intent is sent when the matching SMS message is received. This value cannot be null.
Return
String? Token to include in an SMS message. This value may be null.
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_MESSAGING.

createForSubscriptionId

Added in API level 31
fun createForSubscriptionId(subId: Int): SmsManager

Get the instance of the SmsManager associated with a particular subscription ID.

Note: Constructing an SmsManager in this manner will never cause an SMS disambiguation dialog to appear, unlike getDefault().


Requires the PackageManager#FEATURE_TELEPHONY_MESSAGING feature which can be detected using PackageManager.hasSystemFeature(String).
Parameters
subId Int: an SMS subscription ID, typically accessed using SubscriptionManager
Return
SmsManager the instance of the SmsManager associated with subscription This value cannot be null.

divideMessage

Added in API level 4
fun divideMessage(text: String!): ArrayList<String!>!

Divide a message text into several fragments, none bigger than the maximum SMS message size.
Requires the PackageManager#FEATURE_TELEPHONY_MESSAGING feature which can be detected using PackageManager.hasSystemFeature(String).

Parameters
text String!: the original message. Must not be null.
Return
ArrayList<String!>! an ArrayList of strings that, in order, comprise the original message.
Exceptions
java.lang.IllegalArgumentException if text is null.

downloadMultimediaMessage

Added in API level 21
fun downloadMultimediaMessage(
    context: Context!,
    locationUrl: String!,
    contentUri: Uri!,
    configOverrides: Bundle!,
    downloadedIntent: PendingIntent!
): Unit

Download an MMS message from carrier by a given location URL

Note: If getDefault() is used to instantiate this manager on a multi-SIM device, this operation may fail downloading the MMS message because no suitable default subscription could be found. In this case, if downloadedIntent is non-null, then the PendingIntent will be sent with an error code RESULT_NO_DEFAULT_SMS_APP. See getDefault() for more information on the conditions where this operation may fail.


Requires the PackageManager#FEATURE_TELEPHONY_MESSAGING feature which can be detected using PackageManager.hasSystemFeature(String).
Parameters
context Context!: application context
locationUrl String!: the location URL of the MMS message to be downloaded, usually obtained from the MMS WAP push notification
contentUri Uri!: the content uri to which the downloaded pdu will be written
configOverrides Bundle!: the carrier-specific messaging configuration values to override for downloading the message.
downloadedIntent PendingIntent!: if not NULL this PendingIntent is broadcast when the message is downloaded, or the download is failed The result code will be Activity.RESULT_OK for success or one of these errors:
MMS_ERROR_UNSPECIFIED
MMS_ERROR_INVALID_APN
MMS_ERROR_UNABLE_CONNECT_MMS
MMS_ERROR_HTTP_FAILURE
MMS_ERROR_IO_ERROR
MMS_ERROR_RETRY
MMS_ERROR_CONFIGURATION_ERROR
MMS_ERROR_NO_DATA_NETWORK
MMS_ERROR_INVALID_SUBSCRIPTION_ID
MMS_ERROR_INACTIVE_SUBSCRIPTION
MMS_ERROR_DATA_DISABLED
MMS_ERROR_MMS_DISABLED_BY_CARRIER
Exceptions
java.lang.IllegalArgumentException if locationUrl or contentUri is empty
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_MESSAGING.

downloadMultimediaMessage

Added in API level 31
fun downloadMultimediaMessage(
    context: Context,
    locationUrl: String,
    contentUri: Uri,
    configOverrides: Bundle?,
    downloadedIntent: PendingIntent?,
    messageId: Long
): Unit

Download an MMS message from carrier by a given location URL Same as downloadMultimediaMessage(android.content.Context,java.lang.String,android.net.Uri,android.os.Bundle,android.app.PendingIntent), but adds an optional messageId.

Note: If getDefault() is used to instantiate this manager on a multi-SIM device, this operation may fail downloading the MMS message because no suitable default subscription could be found. In this case, if downloadedIntent is non-null, then the PendingIntent will be sent with an error code RESULT_NO_DEFAULT_SMS_APP. See getDefault() for more information on the conditions where this operation may fail.


Requires the PackageManager#FEATURE_TELEPHONY_MESSAGING feature which can be detected using PackageManager.hasSystemFeature(String).
Parameters
context Context: application context This value cannot be null.
locationUrl String: the location URL of the MMS message to be downloaded, usually obtained from the MMS WAP push notification This value cannot be null.
contentUri Uri: the content uri to which the downloaded pdu will be written This value cannot be null.
configOverrides Bundle?: the carrier-specific messaging configuration values to override for downloading the message. This value may be null.
downloadedIntent PendingIntent?: if not NULL this PendingIntent is broadcast when the message is downloaded, or the download is failed The result code will be Activity.RESULT_OK for success or one of these errors:
MMS_ERROR_UNSPECIFIED
MMS_ERROR_INVALID_APN
MMS_ERROR_UNABLE_CONNECT_MMS
MMS_ERROR_HTTP_FAILURE
MMS_ERROR_IO_ERROR
MMS_ERROR_RETRY
MMS_ERROR_CONFIGURATION_ERROR
MMS_ERROR_NO_DATA_NETWORK
MMS_ERROR_INVALID_SUBSCRIPTION_ID
MMS_ERROR_INACTIVE_SUBSCRIPTION
MMS_ERROR_DATA_DISABLED
MMS_ERROR_MMS_DISABLED_BY_CARRIER
This value may be null.
messageId Long: an id that uniquely identifies the message requested to be downloaded. Used for logging and diagnostics purposes. The id may be 0.
Exceptions
java.lang.IllegalArgumentException if locationUrl or contentUri is empty
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_MESSAGING.

getCarrierConfigValues

Added in API level 21
fun getCarrierConfigValues(): Bundle

Get carrier-dependent MMS configuration values.

Note: This method is intended for internal use by carrier applications or the Telephony framework and will never trigger an SMS disambiguation dialog. If this method is called on a device that has multiple active subscriptions, this SmsManager instance has been created with getDefault(), and no user-defined default subscription is defined, the subscription ID associated with this message will be INVALID, which will result in the operation being completed on the subscription associated with logical slot 0. Use getSmsManagerForSubscriptionId(int) to ensure the operation is performed on the correct subscription.


Requires the PackageManager#FEATURE_TELEPHONY_MESSAGING feature which can be detected using PackageManager.hasSystemFeature(String).
Return
Bundle the bundle key/values pairs that contains MMS configuration values or an empty Bundle if they cannot be found. This value cannot be null.
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_MESSAGING.

getDefault

Added in API level 4
Deprecated in API level 31
static fun getDefault(): SmsManager!

Deprecated: Use android.content.Context#getSystemService instead

Get the SmsManager associated with the default subscription id. The instance will always be associated with the default subscription id, even if the default subscription id changes.

Note: For devices that support multiple active subscriptions at a time, SmsManager will track the subscription set by the user as the default SMS subscription. If the user has not set a default, SmsManager may start an activity to kick off a subscription disambiguation dialog. Most operations will not complete until the user has chosen the subscription that will be associated with the operation. If the user cancels the dialog without choosing a subscription, one of the following will happen, depending on the target SDK version of the application. For compatibility purposes, if the target SDK level is <= 28, telephony will still send the SMS over the first available subscription. If the target SDK level is > 28, the operation will fail to complete.

Note: If this method is used to perform an operation on a device that has multiple active subscriptions, the user has not set a default SMS subscription, and the operation is being performed while the application is not in the foreground, the SMS disambiguation dialog will not be shown. The result of the operation will conclude as if the user cancelled the disambiguation dialog and the operation will finish as outlined above, depending on the target SDK version of the calling application. It is safer to use getSmsManagerForSubscriptionId(int) if the application will perform the operation while in the background because this can cause unpredictable results, such as the operation being sent over the wrong subscription or failing completely, depending on the user's default SMS subscription setting.

Return
SmsManager! the SmsManager associated with the default subscription id.

getDefaultSmsSubscriptionId

Added in API level 22
static fun getDefaultSmsSubscriptionId(): Int

Get default sms subscription id.

Note:This returns a value different from SubscriptionManager#getDefaultSmsSubscriptionId if the user has not chosen a default. In this case it returns the active subscription id if there's only one active subscription available.
Requires the PackageManager#FEATURE_TELEPHONY_MESSAGING feature which can be detected using PackageManager.hasSystemFeature(String).

Return
Int the user-defined default SMS subscription id, or the active subscription id if there's only one active subscription available, otherwise SubscriptionManager#INVALID_SUBSCRIPTION_ID.
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_MESSAGING.

getSmsCapacityOnIcc

Added in API level 31
fun getSmsCapacityOnIcc(): Int

Gets the total capacity of SMS storage on the SIM card.

This is the number of 176 byte EF-SMS records which can be stored on the SIM card. See 3GPP TS 31.102 - 4.2.25 - EF-SMS for more information.

Note: This method will never trigger an SMS disambiguation dialog. If this method is called on a device that has multiple active subscriptions, this SmsManager instance has been created with getDefault(), and no user-defined default subscription is defined, the subscription ID associated with this method will be INVALID, which will result in the operation being completed on the subscription associated with logical slot 0. Use getSmsManagerForSubscriptionId(int) to ensure the operation is performed on the correct subscription.


Requires android.Manifest.permission#READ_PHONE_STATE or android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE
Requires the PackageManager#FEATURE_TELEPHONY_MESSAGING feature which can be detected using PackageManager.hasSystemFeature(String).
Return
Int the total number of SMS records which can be stored on the SIM card. Value is 0 or greater
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_MESSAGING.

getSmsManagerForSubscriptionId

Added in API level 22
Deprecated in API level 31
static fun getSmsManagerForSubscriptionId(subId: Int): SmsManager!

Deprecated: Use android.content.Context#getSystemService .createForSubscriptionId(subId) instead

Get the instance of the SmsManager associated with a particular subscription ID.

Note: Constructing an SmsManager in this manner will never cause an SMS disambiguation dialog to appear, unlike getDefault().


Requires the PackageManager#FEATURE_TELEPHONY_MESSAGING feature which can be detected using PackageManager.hasSystemFeature(String).
Parameters
subId Int: an SMS subscription ID, typically accessed using SubscriptionManager
Return
SmsManager! the instance of the SmsManager associated with subscription

getSmsMessagesForFinancialApp

Added in API level 29
fun getSmsMessagesForFinancialApp(
    params: Bundle!,
    executor: Executor,
    callback: SmsManager.FinancialSmsCallback
): Unit

Get SMS messages for the calling financial app. The result will be delivered asynchronously in the passing in callback interface.

Note: This method will never trigger an SMS disambiguation dialog. If this method is called on a device that has multiple active subscriptions, this SmsManager instance has been created with getDefault(), and no user-defined default subscription is defined, the subscription ID associated with this message will be INVALID, which will result in the operation being completed on the subscription associated with logical slot 0. Use getSmsManagerForSubscriptionId(int) to ensure the operation is performed on the correct subscription.


Requires android.Manifest.permission#SMS_FINANCIAL_TRANSACTIONS
Parameters
params Bundle!: the parameters to filter SMS messages returned.
executor Executor: the executor on which callback will be invoked. This value cannot be null. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). Otherwise, provide an Executor that dispatches to an appropriate thread.
callback SmsManager.FinancialSmsCallback: a callback to receive CursorWindow with SMS messages. This value cannot be null.

getSmscAddress

Added in API level 30
fun getSmscAddress(): String?

Gets the SMSC address from (U)SIM.

Note: Using this method requires that your app is the default SMS application, or READ_PRIVILEGED_PHONE_STATE permission, or has the carrier privileges.

Note: This method will never trigger an SMS disambiguation dialog. If this method is called on a device that has multiple active subscriptions, this SmsManager instance has been created with getDefault(), and no user-defined default subscription is defined, the subscription ID associated with this method will be INVALID, which will result in the operation being completed on the subscription associated with logical slot 0. Use getSmsManagerForSubscriptionId(int) to ensure the operation is performed on the correct subscription.


Requires android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE
Requires the PackageManager#FEATURE_TELEPHONY_MESSAGING feature which can be detected using PackageManager.hasSystemFeature(String).
Return
String? the SMSC address string, null if failed.
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_MESSAGING.

getSubscriptionId

Added in API level 22
fun getSubscriptionId(): Int

Get the associated subscription id. If the instance was returned by getDefault(), then this method may return different values at different points in time (if the user changes the default subscription id).

Note: This method used to display a disambiguation dialog to the user asking them to choose a default subscription to send SMS messages over if they haven't chosen yet. Starting in API level 29, we allow the user to not have a default set as a valid option for the default SMS subscription on multi-SIM devices. We no longer show the disambiguation dialog and return SubscriptionManager#INVALID_SUBSCRIPTION_ID if the device has multiple active subscriptions and no default is set.


Requires the PackageManager#FEATURE_TELEPHONY_MESSAGING feature which can be detected using PackageManager.hasSystemFeature(String).
Return
Int associated subscription ID or SubscriptionManager#INVALID_SUBSCRIPTION_ID if the default subscription id cannot be determined or the device has multiple active subscriptions and and no default is set ("ask every time") by the user.
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_MESSAGING.

injectSmsPdu

Added in API level 22
fun injectSmsPdu(
    pdu: ByteArray!,
    format: String!,
    receivedIntent: PendingIntent!
): Unit

Inject an SMS PDU into the android application framework.

Requires permission: android.Manifest.permission#MODIFY_PHONE_STATE or carrier privileges per android.telephony.TelephonyManager#hasCarrierPrivileges.

Note: This method is intended for internal use by carrier applications or the Telephony framework and will never trigger an SMS disambiguation dialog. If this method is called on a device that has multiple active subscriptions, this SmsManager instance has been created with getDefault(), and no user-defined default subscription is defined, the subscription ID associated with this message will be INVALID, which will result in the SMS being injected on the subscription associated with logical slot 0. Use getSmsManagerForSubscriptionId(int) to ensure the SMS is delivered to the correct subscription.


Requires the PackageManager#FEATURE_TELEPHONY_MESSAGING feature which can be detected using PackageManager.hasSystemFeature(String).
Parameters
pdu ByteArray!: is the byte array of pdu to be injected into android application framework
format String!: is the format of SMS pdu (SmsMessage#FORMAT_3GPP or SmsMessage#FORMAT_3GPP2) Value is android.telephony.SmsMessage#FORMAT_3GPP, or android.telephony.SmsMessage#FORMAT_3GPP2
receivedIntent PendingIntent!: if not NULL this PendingIntent is broadcast when the message is successfully received by the android application framework, or failed. This intent is broadcasted at the same time an SMS received from radio is acknowledged back. The result code will be android.provider.Telephony.Sms.Intents#RESULT_SMS_HANDLED for success, or android.provider.Telephony.Sms.Intents#RESULT_SMS_GENERIC_ERROR or RESULT_REMOTE_EXCEPTION for error.
Exceptions
java.lang.IllegalArgumentException if the format is invalid.
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_MESSAGING.

sendDataMessage

Added in API level 4
fun sendDataMessage(
    destinationAddress: String!,
    scAddress: String!,
    destinationPort: Short,
    data: ByteArray!,
    sentIntent: PendingIntent!,
    deliveryIntent: PendingIntent!
): Unit

Send a data based SMS to a specific application port.

Note: Using this method requires that your app has the android.Manifest.permission#SEND_SMS permission.

Note: If getDefault() is used to instantiate this manager on a multi-SIM device, this operation may fail sending the SMS message because no suitable default subscription could be found. In this case, if sentIntent is non-null, then the PendingIntent will be sent with an error code RESULT_ERROR_GENERIC_FAILURE and an extra string "noDefault" containing the boolean value true. See getDefault() for more information on the conditions where this operation may fail.


Requires the PackageManager#FEATURE_TELEPHONY_MESSAGING feature which can be detected using PackageManager.hasSystemFeature(String).
Parameters
destinationAddress String!: the address to send the message to
scAddress String!: is the service center address or null to use the current default SMSC
destinationPort Short: the port to deliver the message to
data ByteArray!: the body of the message to send
sentIntent PendingIntent!: if not NULL this PendingIntent is broadcast when the message is successfully sent, or failed. The result code will be Activity.RESULT_OK for success, or one of these errors:
RESULT_ERROR_GENERIC_FAILURE
RESULT_ERROR_RADIO_OFF
RESULT_ERROR_NULL_PDU
RESULT_ERROR_NO_SERVICE
RESULT_ERROR_LIMIT_EXCEEDED
RESULT_ERROR_FDN_CHECK_FAILURE
RESULT_ERROR_SHORT_CODE_NOT_ALLOWED
RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED
RESULT_RADIO_NOT_AVAILABLE
RESULT_NETWORK_REJECT
RESULT_INVALID_ARGUMENTS
RESULT_INVALID_STATE
RESULT_NO_MEMORY
RESULT_INVALID_SMS_FORMAT
RESULT_SYSTEM_ERROR
RESULT_MODEM_ERROR
RESULT_NETWORK_ERROR
RESULT_ENCODING_ERROR
RESULT_INVALID_SMSC_ADDRESS
RESULT_OPERATION_NOT_ALLOWED
RESULT_INTERNAL_ERROR
RESULT_NO_RESOURCES
RESULT_CANCELLED
RESULT_REQUEST_NOT_SUPPORTED
RESULT_NO_BLUETOOTH_SERVICE
RESULT_INVALID_BLUETOOTH_ADDRESS
RESULT_BLUETOOTH_DISCONNECTED
RESULT_UNEXPECTED_EVENT_STOP_SENDING
RESULT_SMS_BLOCKED_DURING_EMERGENCY
RESULT_SMS_SEND_RETRY_FAILED
RESULT_REMOTE_EXCEPTION
RESULT_NO_DEFAULT_SMS_APP
RESULT_RIL_RADIO_NOT_AVAILABLE
RESULT_RIL_SMS_SEND_FAIL_RETRY
RESULT_RIL_NETWORK_REJECT
RESULT_RIL_INVALID_STATE
RESULT_RIL_INVALID_ARGUMENTS
RESULT_RIL_NO_MEMORY
RESULT_RIL_REQUEST_RATE_LIMITED
RESULT_RIL_INVALID_SMS_FORMAT
RESULT_RIL_SYSTEM_ERR
RESULT_RIL_ENCODING_ERR
RESULT_RIL_INVALID_SMSC_ADDRESS
RESULT_RIL_MODEM_ERR
RESULT_RIL_NETWORK_ERR
RESULT_RIL_INTERNAL_ERR
RESULT_RIL_REQUEST_NOT_SUPPORTED
RESULT_RIL_INVALID_MODEM_STATE
RESULT_RIL_NETWORK_NOT_READY
RESULT_RIL_OPERATION_NOT_ALLOWED
RESULT_RIL_NO_RESOURCES
RESULT_RIL_CANCELLED
RESULT_RIL_SIM_ABSENT
RESULT_RIL_SIMULTANEOUS_SMS_AND_CALL_NOT_ALLOWED
RESULT_RIL_ACCESS_BARRED
RESULT_RIL_BLOCKED_DUE_TO_CALL
For RESULT_ERROR_GENERIC_FAILURE or any of the RESULT_RIL errors, the sentIntent may include the extra "errorCode" containing a radio technology specific value, generally only useful for troubleshooting.
deliveryIntent PendingIntent!: if not NULL this PendingIntent is broadcast when the message is delivered to the recipient. The raw pdu of the status report is in the extended data ("pdu").
Exceptions
java.lang.IllegalArgumentException if destinationAddress or data are empty
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_MESSAGING.

sendMultimediaMessage

Added in API level 21
fun sendMultimediaMessage(
    context: Context!,
    contentUri: Uri!,
    locationUrl: String!,
    configOverrides: Bundle!,
    sentIntent: PendingIntent!
): Unit

Send an MMS message

Note: If getDefault() is used to instantiate this manager on a multi-SIM device, this operation may fail sending the MMS message because no suitable default subscription could be found. In this case, if sentIntent is non-null, then the PendingIntent will be sent with an error code RESULT_NO_DEFAULT_SMS_APP. See getDefault() for more information on the conditions where this operation may fail.


Requires the PackageManager#FEATURE_TELEPHONY_MESSAGING feature which can be detected using PackageManager.hasSystemFeature(String).
Parameters
context Context!: application context
contentUri Uri!: the content Uri from which the message pdu will be read
locationUrl String!: the optional location url where message should be sent to
configOverrides Bundle!: the carrier-specific messaging configuration values to override for sending the message.
sentIntent PendingIntent!: if not NULL this PendingIntent is broadcast when the message is successfully sent, or failed The result code will be Activity.RESULT_OK for success or one of these errors:
MMS_ERROR_UNSPECIFIED
MMS_ERROR_INVALID_APN
MMS_ERROR_UNABLE_CONNECT_MMS
MMS_ERROR_HTTP_FAILURE
MMS_ERROR_IO_ERROR
MMS_ERROR_RETRY
MMS_ERROR_CONFIGURATION_ERROR
MMS_ERROR_NO_DATA_NETWORK
MMS_ERROR_INVALID_SUBSCRIPTION_ID
MMS_ERROR_INACTIVE_SUBSCRIPTION
MMS_ERROR_DATA_DISABLED
MMS_ERROR_MMS_DISABLED_BY_CARRIER
Exceptions
java.lang.IllegalArgumentException if contentUri is empty
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_MESSAGING.

sendMultimediaMessage

Added in API level 31
fun sendMultimediaMessage(
    context: Context,
    contentUri: Uri,
    locationUrl: String?,
    configOverrides: Bundle?,
    sentIntent: PendingIntent?,
    messageId: Long
): Unit

Send an MMS message Same as sendMultimediaMessage(android.content.Context,android.net.Uri,java.lang.String,android.os.Bundle,android.app.PendingIntent), but adds an optional messageId.

Note: If getDefault() is used to instantiate this manager on a multi-SIM device, this operation may fail sending the MMS message because no suitable default subscription could be found. In this case, if sentIntent is non-null, then the PendingIntent will be sent with an error code RESULT_NO_DEFAULT_SMS_APP. See getDefault() for more information on the conditions where this operation may fail.


Requires the PackageManager#FEATURE_TELEPHONY_MESSAGING feature which can be detected using PackageManager.hasSystemFeature(String).
Parameters
context Context: application context This value cannot be null.
contentUri Uri: the content Uri from which the message pdu will be read This value cannot be null.
locationUrl String?: the optional location url where message should be sent to This value may be null.
configOverrides Bundle?: the carrier-specific messaging configuration values to override for sending the message. This value may be null.
sentIntent PendingIntent?: if not NULL this PendingIntent is broadcast when the message is successfully sent, or failed The result code will be Activity.RESULT_OK for success or one of these errors:
MMS_ERROR_UNSPECIFIED
MMS_ERROR_INVALID_APN
MMS_ERROR_UNABLE_CONNECT_MMS
MMS_ERROR_HTTP_FAILURE
MMS_ERROR_IO_ERROR
MMS_ERROR_RETRY
MMS_ERROR_CONFIGURATION_ERROR
MMS_ERROR_NO_DATA_NETWORK
MMS_ERROR_INVALID_SUBSCRIPTION_ID
MMS_ERROR_INACTIVE_SUBSCRIPTION
MMS_ERROR_DATA_DISABLED
MMS_ERROR_MMS_DISABLED_BY_CARRIER
This value may be null.
messageId Long: an id that uniquely identifies the message requested to be sent. Used for logging and diagnostics purposes. The id may be 0.
Exceptions
java.lang.IllegalArgumentException if contentUri is empty
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_MESSAGING.

sendMultipartTextMessage

Added in API level 4
fun sendMultipartTextMessage(
    destinationAddress: String!,
    scAddress: String!,
    parts: ArrayList<String!>!,
    sentIntents: ArrayList<PendingIntent!>!,
    deliveryIntents: ArrayList<PendingIntent!>!
): Unit

Send a multi-part text based SMS. The callee should have already divided the message into correctly sized parts by calling divideMessage.

Note: Using this method requires that your app has the android.Manifest.permission#SEND_SMS permission.

Note: Beginning with Android 4.4 (API level 19), if and only if an app is not selected as the default SMS app, the system automatically writes messages sent using this method to the SMS Provider (the default SMS app is always responsible for writing its sent messages to the SMS Provider). For information about how to behave as the default SMS app, see android.provider.Telephony.

Note: If getDefault() is used to instantiate this manager on a multi-SIM device, this operation may fail sending the SMS message because no suitable default subscription could be found. In this case, if sentIntent is non-null, then the PendingIntent will be sent with an error code RESULT_ERROR_GENERIC_FAILURE and an extra string "noDefault" containing the boolean value true. See getDefault() for more information on the conditions where this operation may fail.


Requires the PackageManager#FEATURE_TELEPHONY_MESSAGING feature which can be detected using PackageManager.hasSystemFeature(String).
Parameters
destinationAddress String!: the address to send the message to
scAddress String!: is the service center address or null to use the current default SMSC
parts ArrayList<String!>!: an ArrayList of strings that, in order, comprise the original message
sentIntents ArrayList<PendingIntent!>!: if not null, an ArrayList of PendingIntents (one for each message part) that is broadcast when the corresponding message part has been sent. The result code will be Activity.RESULT_OK for success, or one of these errors:
RESULT_ERROR_GENERIC_FAILURE
RESULT_ERROR_RADIO_OFF
RESULT_ERROR_NULL_PDU
RESULT_ERROR_NO_SERVICE
RESULT_ERROR_LIMIT_EXCEEDED
RESULT_ERROR_FDN_CHECK_FAILURE
RESULT_ERROR_SHORT_CODE_NOT_ALLOWED
RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED
RESULT_RADIO_NOT_AVAILABLE
RESULT_NETWORK_REJECT
RESULT_INVALID_ARGUMENTS
RESULT_INVALID_STATE
RESULT_NO_MEMORY
RESULT_INVALID_SMS_FORMAT
RESULT_SYSTEM_ERROR
RESULT_MODEM_ERROR
RESULT_NETWORK_ERROR
RESULT_ENCODING_ERROR
RESULT_INVALID_SMSC_ADDRESS
RESULT_OPERATION_NOT_ALLOWED
RESULT_INTERNAL_ERROR
RESULT_NO_RESOURCES
RESULT_CANCELLED
RESULT_REQUEST_NOT_SUPPORTED
RESULT_NO_BLUETOOTH_SERVICE
RESULT_INVALID_BLUETOOTH_ADDRESS
RESULT_BLUETOOTH_DISCONNECTED
RESULT_UNEXPECTED_EVENT_STOP_SENDING
RESULT_SMS_BLOCKED_DURING_EMERGENCY
RESULT_SMS_SEND_RETRY_FAILED
RESULT_REMOTE_EXCEPTION
RESULT_NO_DEFAULT_SMS_APP
RESULT_RIL_RADIO_NOT_AVAILABLE
RESULT_RIL_SMS_SEND_FAIL_RETRY
RESULT_RIL_NETWORK_REJECT
RESULT_RIL_INVALID_STATE
RESULT_RIL_INVALID_ARGUMENTS
RESULT_RIL_NO_MEMORY
RESULT_RIL_REQUEST_RATE_LIMITED
RESULT_RIL_INVALID_SMS_FORMAT
RESULT_RIL_SYSTEM_ERR
RESULT_RIL_ENCODING_ERR
RESULT_RIL_INVALID_SMSC_ADDRESS
RESULT_RIL_MODEM_ERR
RESULT_RIL_NETWORK_ERR
RESULT_RIL_INTERNAL_ERR
RESULT_RIL_REQUEST_NOT_SUPPORTED
RESULT_RIL_INVALID_MODEM_STATE
RESULT_RIL_NETWORK_NOT_READY
RESULT_RIL_OPERATION_NOT_ALLOWED
RESULT_RIL_NO_RESOURCES
RESULT_RIL_CANCELLED
RESULT_RIL_SIM_ABSENT
RESULT_RIL_SIMULTANEOUS_SMS_AND_CALL_NOT_ALLOWED
RESULT_RIL_ACCESS_BARRED
RESULT_RIL_BLOCKED_DUE_TO_CALL
For RESULT_ERROR_GENERIC_FAILURE or any of the RESULT_RIL errors, the sentIntent may include the extra "errorCode" containing a radio technology specific value, generally only useful for troubleshooting.
deliveryIntents ArrayList<PendingIntent!>!: if not null, an ArrayList of PendingIntents (one for each message part) that is broadcast when the corresponding message part has been delivered to the recipient. The raw pdu of the status report is in the extended data ("pdu").
Exceptions
java.lang.IllegalArgumentException if destinationAddress or data are empty
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_MESSAGING.

sendMultipartTextMessage

Added in API level 30
fun sendMultipartTextMessage(
    destinationAddress: String,
    scAddress: String?,
    parts: MutableList<String!>,
    sentIntents: MutableList<PendingIntent!>?,
    deliveryIntents: MutableList<PendingIntent!>?,
    messageId: Long
): Unit

Send a multi-part text based SMS. Same as #sendMultipartTextMessage(String, String, ArrayList, ArrayList, ArrayList), but adds an optional messageId.
Requires the PackageManager#FEATURE_TELEPHONY_MESSAGING feature which can be detected using PackageManager.hasSystemFeature(String).

Parameters
messageId Long: An id that uniquely identifies the message requested to be sent. Used for logging and diagnostics purposes. The id may be 0.
destinationAddress String: This value cannot be null.
scAddress String?: This value may be null.
parts MutableList<String!>: This value cannot be null.
sentIntents MutableList<PendingIntent!>?: This value may be null.
deliveryIntents MutableList<PendingIntent!>?: This value may be null.
Exceptions
java.lang.IllegalArgumentException if destinationAddress or data are empty
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_MESSAGING.

sendMultipartTextMessage

Added in API level 30
fun sendMultipartTextMessage(
    destinationAddress: String,
    scAddress: String?,
    parts: MutableList<String!>,
    sentIntents: MutableList<PendingIntent!>?,
    deliveryIntents: MutableList<PendingIntent!>?,
    packageName: String,
    attributionTag: String?
): Unit

Similar method as #sendMultipartTextMessage(String, String, ArrayList, ArrayList, ArrayList) With an additional argument.

Note: This method is intended for internal use the Telephony framework and will never trigger an SMS disambiguation dialog. If this method is called on a device that has multiple active subscriptions, this SmsManager instance has been created with getDefault(), and no user-defined default subscription is defined, the subscription ID associated with this message will be INVALID, which will result in the SMS being sent on the subscription associated with logical slot 0. Use getSmsManagerForSubscriptionId(int) to ensure the SMS is sent on the correct subscription.


Requires the PackageManager#FEATURE_TELEPHONY_MESSAGING feature which can be detected using PackageManager.hasSystemFeature(String).
Parameters
packageName String: serves as the default package name if the package name that is associated with the user id is null.
destinationAddress String: This value cannot be null.
scAddress String?: This value may be null.
parts MutableList<String!>: This value cannot be null.
sentIntents MutableList<PendingIntent!>?: This value may be null.
deliveryIntents MutableList<PendingIntent!>?: This value may be null.
attributionTag String?: This value may be null.
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_MESSAGING.

sendTextMessage

Added in API level 4
fun sendTextMessage(
    destinationAddress: String!,
    scAddress: String!,
    text: String!,
    sentIntent: PendingIntent!,
    deliveryIntent: PendingIntent!
): Unit

Send a text based SMS.

Note: Using this method requires that your app has the android.Manifest.permission#SEND_SMS permission.

Note: Beginning with Android 4.4 (API level 19), if and only if an app is not selected as the default SMS app, the system automatically writes messages sent using this method to the SMS Provider (the default SMS app is always responsible for writing its sent messages to the SMS Provider). For information about how to behave as the default SMS app, see android.provider.Telephony.

Note: If getDefault() is used to instantiate this manager on a multi-SIM device, this operation may fail sending the SMS message because no suitable default subscription could be found. In this case, if sentIntent is non-null, then the PendingIntent will be sent with an error code RESULT_ERROR_GENERIC_FAILURE and an extra string "noDefault" containing the boolean value true. See getDefault() for more information on the conditions where this operation may fail.


Requires the PackageManager#FEATURE_TELEPHONY_MESSAGING feature which can be detected using PackageManager.hasSystemFeature(String).
Parameters
destinationAddress String!: the address to send the message to
scAddress String!: is the service center address or null to use the current default SMSC
text String!: the body of the message to send
sentIntent PendingIntent!: if not NULL this PendingIntent is broadcast when the message is successfully sent, or failed. The result code will be Activity.RESULT_OK for success, or one of these errors:
RESULT_ERROR_GENERIC_FAILURE
RESULT_ERROR_RADIO_OFF
RESULT_ERROR_NULL_PDU
RESULT_ERROR_NO_SERVICE
RESULT_ERROR_LIMIT_EXCEEDED
RESULT_ERROR_FDN_CHECK_FAILURE
RESULT_ERROR_SHORT_CODE_NOT_ALLOWED
RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED
RESULT_RADIO_NOT_AVAILABLE
RESULT_NETWORK_REJECT
RESULT_INVALID_ARGUMENTS
RESULT_INVALID_STATE
RESULT_NO_MEMORY
RESULT_INVALID_SMS_FORMAT
RESULT_SYSTEM_ERROR
RESULT_MODEM_ERROR
RESULT_NETWORK_ERROR
RESULT_ENCODING_ERROR
RESULT_INVALID_SMSC_ADDRESS
RESULT_OPERATION_NOT_ALLOWED
RESULT_INTERNAL_ERROR
RESULT_NO_RESOURCES
RESULT_CANCELLED
RESULT_REQUEST_NOT_SUPPORTED
RESULT_NO_BLUETOOTH_SERVICE
RESULT_INVALID_BLUETOOTH_ADDRESS
RESULT_BLUETOOTH_DISCONNECTED
RESULT_UNEXPECTED_EVENT_STOP_SENDING
RESULT_SMS_BLOCKED_DURING_EMERGENCY
RESULT_SMS_SEND_RETRY_FAILED
RESULT_REMOTE_EXCEPTION
RESULT_NO_DEFAULT_SMS_APP
RESULT_RIL_RADIO_NOT_AVAILABLE
RESULT_RIL_SMS_SEND_FAIL_RETRY
RESULT_RIL_NETWORK_REJECT
RESULT_RIL_INVALID_STATE
RESULT_RIL_INVALID_ARGUMENTS
RESULT_RIL_NO_MEMORY
RESULT_RIL_REQUEST_RATE_LIMITED
RESULT_RIL_INVALID_SMS_FORMAT
RESULT_RIL_SYSTEM_ERR
RESULT_RIL_ENCODING_ERR
RESULT_RIL_INVALID_SMSC_ADDRESS
RESULT_RIL_MODEM_ERR
RESULT_RIL_NETWORK_ERR
RESULT_RIL_INTERNAL_ERR
RESULT_RIL_REQUEST_NOT_SUPPORTED
RESULT_RIL_INVALID_MODEM_STATE
RESULT_RIL_NETWORK_NOT_READY
RESULT_RIL_OPERATION_NOT_ALLOWED
RESULT_RIL_NO_RESOURCES
RESULT_RIL_CANCELLED
RESULT_RIL_SIM_ABSENT
RESULT_RIL_SIMULTANEOUS_SMS_AND_CALL_NOT_ALLOWED
RESULT_RIL_ACCESS_BARRED
RESULT_RIL_BLOCKED_DUE_TO_CALL
For RESULT_ERROR_GENERIC_FAILURE or any of the RESULT_RIL errors, the sentIntent may include the extra "errorCode" containing a radio technology specific value, generally only useful for troubleshooting.
deliveryIntent PendingIntent!: if not NULL this PendingIntent is broadcast when the message is delivered to the recipient. The raw pdu of the status report is in the extended data ("pdu").
Exceptions
java.lang.IllegalArgumentException if destinationAddress or text are empty
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_MESSAGING.

sendTextMessage

Added in API level 30
fun sendTextMessage(
    destinationAddress: String,
    scAddress: String?,
    text: String,
    sentIntent: PendingIntent?,
    deliveryIntent: PendingIntent?,
    messageId: Long
): Unit

Send a text based SMS. Same as sendTextMessage(java.lang.String,java.lang.String,java.lang.String,android.app.PendingIntent,android.app.PendingIntent), but adds an optional messageId.
Requires the PackageManager#FEATURE_TELEPHONY_MESSAGING feature which can be detected using PackageManager.hasSystemFeature(String).

Parameters
messageId Long: An id that uniquely identifies the message requested to be sent. Used for logging and diagnostics purposes. The id may be 0.
destinationAddress String: This value cannot be null.
scAddress String?: This value may be null.
text String: This value cannot be null.
sentIntent PendingIntent?: This value may be null.
deliveryIntent PendingIntent?: This value may be null.
Exceptions
java.lang.IllegalArgumentException if destinationAddress or text are empty
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_MESSAGING.

sendTextMessageWithoutPersisting

Added in API level 28
fun sendTextMessageWithoutPersisting(
    destinationAddress: String!,
    scAddress: String!,
    text: String!,
    sentIntent: PendingIntent!,
    deliveryIntent: PendingIntent!
): Unit

Send a text based SMS without writing it into the SMS Provider.

The message will be sent directly over the network and will not be visible in SMS applications. Intended for internal carrier use only.

Requires Permission: Both android.Manifest.permission#SEND_SMS and android.Manifest.permission#MODIFY_PHONE_STATE, or that the calling app has carrier privileges (see TelephonyManager#hasCarrierPrivileges), or that the calling app is the default IMS app (see CarrierConfigManager#KEY_CONFIG_IMS_PACKAGE_OVERRIDE_STRING).

Note: This method is intended for internal use by carrier applications or the Telephony framework and will never trigger an SMS disambiguation dialog. If this method is called on a device that has multiple active subscriptions, this SmsManager instance has been created with getDefault(), and no user-defined default subscription is defined, the subscription ID associated with this message will be INVALID, which will result in the SMS being sent on the subscription associated with logical slot 0. Use getSmsManagerForSubscriptionId(int) to ensure the SMS is sent on the correct subscription.


Requires android.Manifest.permission#MODIFY_PHONE_STATE and android.Manifest.permission#SEND_SMS
Requires the PackageManager#FEATURE_TELEPHONY_MESSAGING feature which can be detected using PackageManager.hasSystemFeature(String).
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_MESSAGING.

setSmscAddress

Added in API level 30
fun setSmscAddress(smsc: String): Boolean

Sets the SMSC address on (U)SIM.

Note: Using this method requires that your app is the default SMS application, or has android.Manifest.permission#MODIFY_PHONE_STATE permission, or has the carrier privileges.

Note: This method will never trigger an SMS disambiguation dialog. If this method is called on a device that has multiple active subscriptions, this SmsManager instance has been created with getDefault(), and no user-defined default subscription is defined, the subscription ID associated with this method will be INVALID, which will result in the operation being completed on the subscription associated with logical slot 0. Use getSmsManagerForSubscriptionId(int) to ensure the operation is performed on the correct subscription.


Requires android.Manifest.permission#MODIFY_PHONE_STATE
Requires the PackageManager#FEATURE_TELEPHONY_MESSAGING feature which can be detected using PackageManager.hasSystemFeature(String).
Parameters
smsc String: the SMSC address string. This value cannot be null.
Return
Boolean true for success, false otherwise. Failure can be due modem returning an error.
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_MESSAGING.