SmsManager
public
final
class
SmsManager
extends Object
java.lang.Object | |
↳ | 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 Telephony
.
Requires the PackageManager#FEATURE_TELEPHONY_MESSAGING
feature which can be detected using PackageManager.hasSystemFeature(String)
.
Summary
Nested classes | |
---|---|
class |
SmsManager.FinancialSmsCallback
callback for providing asynchronous sms messages for financial app. |
Constants | |
---|---|
String |
EXTRA_MMS_DATA
Intent extra name for MMS sending result data in byte array type |
String |
EXTRA_MMS_HTTP_STATUS
Intent extra name for HTTP status code for MMS HTTP failure in integer type |
String |
MMS_CONFIG_ALIAS_ENABLED
Whether alias is enabled (boolean type) |
String |
MMS_CONFIG_ALIAS_MAX_CHARS
Max alias character count (int type) |
String |
MMS_CONFIG_ALIAS_MIN_CHARS
Min alias character count (int type) |
String |
MMS_CONFIG_ALLOW_ATTACH_AUDIO
Whether audio is allowed to be attached for MMS messages (boolean type) |
String |
MMS_CONFIG_APPEND_TRANSACTION_ID
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) |
String |
MMS_CONFIG_EMAIL_GATEWAY_NUMBER
Email gateway number (String type) |
String |
MMS_CONFIG_GROUP_MMS_ENABLED
Whether group MMS is enabled for the current carrier (boolean type) |
String |
MMS_CONFIG_HTTP_PARAMS
A list of HTTP headers to add to MMS HTTP request, separated by "|" (String type) |
String |
MMS_CONFIG_HTTP_SOCKET_TIMEOUT
MMS HTTP socket timeout in milliseconds (int type) |
String |
MMS_CONFIG_MAX_IMAGE_HEIGHT
Max MMS image height (int type) |
String |
MMS_CONFIG_MAX_IMAGE_WIDTH
Max MMS image width (int type) |
String |
MMS_CONFIG_MAX_MESSAGE_SIZE
Max MMS message size in bytes (int type) |
String |
MMS_CONFIG_MESSAGE_TEXT_MAX_SIZE
Max message text size (int type) |
String |
MMS_CONFIG_MMS_DELIVERY_REPORT_ENABLED
Whether MMS delivery report is enabled (boolean type) |
String |
MMS_CONFIG_MMS_ENABLED
Whether MMS is enabled for the current carrier (boolean type) |
String |
MMS_CONFIG_MMS_READ_REPORT_ENABLED
Whether MMS read report is enabled (boolean type) |
String |
MMS_CONFIG_MULTIPART_SMS_ENABLED
Whether multipart SMS is enabled (boolean type) |
String |
MMS_CONFIG_NAI_SUFFIX
The suffix to append to the NAI header value for MMS HTTP request (String type) |
String |
MMS_CONFIG_NOTIFY_WAP_MMSC_ENABLED
If this is enabled, M-NotifyResp.ind should be sent to the WAP Push content location instead of the default MMSC (boolean type) |
String |
MMS_CONFIG_RECIPIENT_LIMIT
Limit of recipients of MMS messages (int type) |
String |
MMS_CONFIG_SEND_MULTIPART_SMS_AS_SEPARATE_MESSAGES
Whether multipart SMS should be sent as separate messages |
String |
MMS_CONFIG_SHOW_CELL_BROADCAST_APP_LINKS
If true, show the cell broadcast (amber alert) in the SMS settings. |
String |
MMS_CONFIG_SMS_DELIVERY_REPORT_ENABLED
Whether SMS delivery report is enabled (boolean type) |
String |
MMS_CONFIG_SMS_TO_MMS_TEXT_LENGTH_THRESHOLD
Some carriers require SMS to be converted into MMS when text length reaches this threshold (int type) |
String |
MMS_CONFIG_SMS_TO_MMS_TEXT_THRESHOLD
When the number of parts of a multipart SMS reaches this threshold, it should be converted into an MMS (int type) |
String |
MMS_CONFIG_SUBJECT_MAX_LENGTH
Max message subject length (int type) |
String |
MMS_CONFIG_SUPPORT_HTTP_CHARSET_HEADER
Whether the carrier MMSC supports charset field in Content-Type header. |
String |
MMS_CONFIG_SUPPORT_MMS_CONTENT_DISPOSITION
Whether content-disposition field should be expected in an MMS PDU (boolean type) |
String |
MMS_CONFIG_UA_PROF_TAG_NAME
The name of the UA Prof URL HTTP header for MMS HTTP request (String type) |
String |
MMS_CONFIG_UA_PROF_URL
The UA Profile URL header value for MMS HTTP request (String type) |
String |
MMS_CONFIG_USER_AGENT
The User-Agent header value for MMS HTTP request (String type) |
int |
MMS_ERROR_CONFIGURATION_ERROR
The carrier-dependent configuration values could not be loaded. |
int |
MMS_ERROR_DATA_DISABLED
Data is disabled for the MMS APN. |
int |
MMS_ERROR_HTTP_FAILURE
An error occurred during the HTTP client setup. |
int |
MMS_ERROR_INACTIVE_SUBSCRIPTION
The subscription id for the send/download is inactive. |
int |
MMS_ERROR_INVALID_APN
ApnException occurred during MMS network setup. |
int |
MMS_ERROR_INVALID_SUBSCRIPTION_ID
The subscription id for the send/download is invalid. |
int |
MMS_ERROR_IO_ERROR
An I/O error occurred reading the PDU. |
int |
MMS_ERROR_MMS_DISABLED_BY_CARRIER
MMS is disabled by a carrier. |
int |
MMS_ERROR_NO_DATA_NETWORK
There is neither Wi-Fi nor mobile data network. |
int |
MMS_ERROR_RETRY
An error occurred while retrying sending/downloading the MMS. |
int |
MMS_ERROR_UNABLE_CONNECT_MMS
An error occurred during the MMS connection setup. |
int |
MMS_ERROR_UNSPECIFIED
Unspecific MMS error occurred during send/download. |
int |
RESULT_BLUETOOTH_DISCONNECTED
Failed sending via bluetooth because bluetooth disconnected |
int |
RESULT_CANCELLED
Failed because the operation was cancelled |
int |
RESULT_ENCODING_ERROR
Failed because of an encoding error |
int |
RESULT_ERROR_FDN_CHECK_FAILURE
Failed because FDN is enabled. |
int |
RESULT_ERROR_GENERIC_FAILURE
Generic failure cause |
int |
RESULT_ERROR_LIMIT_EXCEEDED
Failed because we reached the sending queue limit. |
int |
RESULT_ERROR_NONE
No error. |
int |
RESULT_ERROR_NO_SERVICE
Failed because service is currently unavailable |
int |
RESULT_ERROR_NULL_PDU
Failed because no pdu provided |
int |
RESULT_ERROR_RADIO_OFF
Failed because radio was explicitly turned off |
int |
RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED
Failed because the user has denied this app ever send premium short codes. |
int |
RESULT_ERROR_SHORT_CODE_NOT_ALLOWED
Failed because user denied the sending of this short code. |
int |
RESULT_INTERNAL_ERROR
Failed because of an internal error |
int |
RESULT_INVALID_ARGUMENTS
Failed because of invalid arguments |
int |
RESULT_INVALID_BLUETOOTH_ADDRESS
Failed sending via bluetooth because the bluetooth device address is invalid |
int |
RESULT_INVALID_SMSC_ADDRESS
Failed because of an invalid smsc address |
int |
RESULT_INVALID_SMS_FORMAT
Failed because the sms format is not valid |
int |
RESULT_INVALID_STATE
Failed because of an invalid state |
int |
RESULT_MODEM_ERROR
Failed because of a modem error |
int |
RESULT_NETWORK_ERROR
Failed because of a network error |
int |
RESULT_NETWORK_REJECT
Failed because of network rejection |
int |
RESULT_NO_BLUETOOTH_SERVICE
Failed sending via bluetooth because the bluetooth service is not available |
int |
RESULT_NO_DEFAULT_SMS_APP
Set by BroadcastReceiver to indicate there's no default sms app. |
int |
RESULT_NO_MEMORY
Failed because there is no memory |
int |
RESULT_NO_RESOURCES
Failed because there are no resources |
int |
RESULT_OPERATION_NOT_ALLOWED
Failed because the operation is not allowed |
int |
RESULT_RADIO_NOT_AVAILABLE
Failed because the radio was not available |
int |
RESULT_RECEIVE_DISPATCH_FAILURE
SMS receive dispatch failure. |
int |
RESULT_RECEIVE_INJECTED_NULL_PDU
SMS receive injected null PDU. |
int |
RESULT_RECEIVE_NULL_MESSAGE_FROM_RIL
SMS received null message from the radio interface layer. |
int |
RESULT_RECEIVE_RUNTIME_EXCEPTION
SMS receive encountered runtime exception. |
int |
RESULT_RECEIVE_SQL_EXCEPTION
SMS receive encountered an SQL exception. |
int |
RESULT_RECEIVE_URI_EXCEPTION
SMS receive an exception parsing a uri. |
int |
RESULT_RECEIVE_WHILE_ENCRYPTED
SMS short code received while the phone is in encrypted state. |
int |
RESULT_REMOTE_EXCEPTION
Set by BroadcastReceiver to indicate a remote exception while handling a message. |
int |
RESULT_REQUEST_NOT_SUPPORTED
Failed because the request is not supported |
int |
RESULT_RIL_ABORTED
Operation aborted |
int |
RESULT_RIL_ACCESS_BARRED
Access is barred. |
int |
RESULT_RIL_BLOCKED_DUE_TO_CALL
SMS is blocked due to call control, e.g., resource unavailable in the SMR entity. |
int |
RESULT_RIL_CANCELLED
The request has been cancelled. |
int |
RESULT_RIL_DEVICE_IN_USE
Operation cannot be performed because the device is currently in use |
int |
RESULT_RIL_ENCODING_ERR
The SMS message was not encoded properly. |
int |
RESULT_RIL_GENERIC_ERROR
A RIL error occurred during the SMS send. |
int |
RESULT_RIL_INTERNAL_ERR
The modem encountered an unexpected error scenario while handling the request. |
int |
RESULT_RIL_INVALID_ARGUMENTS
The radio received invalid arguments in the request. |
int |
RESULT_RIL_INVALID_MODEM_STATE
The radio cannot process the request in the current modem state. |
int |
RESULT_RIL_INVALID_RESPONSE
A RIL internal error when one of the RIL layers receives an unrecognized response from a lower layer. |
int |
RESULT_RIL_INVALID_SIM_STATE
Cannot process the request in current SIM state |
int |
RESULT_RIL_INVALID_SMSC_ADDRESS
The specified SMSC address was invalid. |
int |
RESULT_RIL_INVALID_SMS_FORMAT
The radio returned an error indicating invalid sms format. |
int |
RESULT_RIL_INVALID_STATE
The radio returned an unexpected request for the current state. |
int |
RESULT_RIL_MODEM_ERR
The vendor RIL received an unexpected or incorrect response. |
int |
RESULT_RIL_NETWORK_ERR
The radio received an error from the network. |
int |
RESULT_RIL_NETWORK_NOT_READY
The network is not ready to perform the request. |
int |
RESULT_RIL_NETWORK_REJECT
The sms request was rejected by the network. |
int |
RESULT_RIL_NO_MEMORY
The radio didn't have sufficient memory to process the request. |
int |
RESULT_RIL_NO_NETWORK_FOUND
Network cannot be found |
int |
RESULT_RIL_NO_RESOURCES
There are insufficient resources to process the request. |
int |
RESULT_RIL_NO_SMS_TO_ACK
ACK received when there is no SMS to ack |
int |
RESULT_RIL_NO_SUBSCRIPTION
Device does not have subscription |
int |
RESULT_RIL_OPERATION_NOT_ALLOWED
The radio reports the request is not allowed. |
int |
RESULT_RIL_RADIO_NOT_AVAILABLE
The radio did not start or is resetting. |
int |
RESULT_RIL_REQUEST_NOT_SUPPORTED
The request was not supported by the radio. |
int |
RESULT_RIL_REQUEST_RATE_LIMITED
The radio denied the operation due to overly-frequent requests. |
int |
RESULT_RIL_SIMULTANEOUS_SMS_AND_CALL_NOT_ALLOWED
1X voice and SMS are not allowed simultaneously. |
int |
RESULT_RIL_SIM_ABSENT
The radio failed to set the location where the CDMA subscription can be retrieved because the SIM or RUIM is absent. |
int |
RESULT_RIL_SIM_BUSY
SIM is busy |
int |
RESULT_RIL_SIM_ERROR
Received error from SIM card |
int |
RESULT_RIL_SIM_FULL
The target EF is full |
int |
RESULT_RIL_SIM_PIN2
Operation requires SIM PIN2 to be entered |
int |
RESULT_RIL_SIM_PUK2
Operation requires SIM PUK2 to be entered |
int |
RESULT_RIL_SMS_SEND_FAIL_RETRY
The radio failed to send the sms and needs to retry. |
int |
RESULT_RIL_SUBSCRIPTION_NOT_AVAILABLE
Fail to find CDMA subscription from specified location |
int |
RESULT_RIL_SYSTEM_ERR
The radio encountered a platform or system error. |
int |
RESULT_SMS_BLOCKED_DURING_EMERGENCY
Failed sending during an emergency call |
int |
RESULT_SMS_SEND_RETRY_FAILED
Failed to send an sms retry |
int |
RESULT_SYSTEM_ERROR
Failed because of a system error |
int |
RESULT_UNEXPECTED_EVENT_STOP_SENDING
Failed sending because the user denied or canceled the dialog displayed for a premium shortcode sms or rate-limited sms. |
int |
RESULT_USER_NOT_ALLOWED
User is not associated with the subscription. |
int |
SMS_RP_CAUSE_CALL_BARRING
RP-Cause Value for Call Barring |
int |
SMS_RP_CAUSE_CONGESTION
RP-Cause Value for SMS Failure due to Congestion in network |
int |
SMS_RP_CAUSE_DESTINATION_OUT_OF_ORDER
RP-Cause Value for Destination is Out of Order |
int |
SMS_RP_CAUSE_FACILITY_NOT_IMPLEMENTED
RP-Cause Value when network does not provide the received service |
int |
SMS_RP_CAUSE_FACILITY_NOT_SUBSCRIBED
RP-Cause Value when SMS Facilty is not subscribed by Reote device |
int |
SMS_RP_CAUSE_FACILITY_REJECTED
RP-Cause Value when SMS Facility if Rejected by Operator |
int |
SMS_RP_CAUSE_INFORMATION_ELEMENT_NON_EXISTENT
RP-Cause Value when network does not provide the received service |
int |
SMS_RP_CAUSE_INTERWORKING_UNSPECIFIED
RP-Cause Value when network does not provide the received service |
int |
SMS_RP_CAUSE_INVALID_MANDATORY_INFORMATION
RP-Cause Value when network does not provide the received service |
int |
SMS_RP_CAUSE_INVALID_MESSAGE_REFERENCE_VALUE
RP-Cause Value when RP-MessageRefere |
int |
SMS_RP_CAUSE_MESSAGE_INCOMPATIBLE_WITH_PROTOCOL_STATE
RP-Cause Value when network does not provide the received service |
int |
SMS_RP_CAUSE_MESSAGE_TYPE_NON_EXISTENT
RP-Cause Value when network does not provide the received service |
int |
SMS_RP_CAUSE_NETWORK_OUT_OF_ORDER
RP-Cause Value when network is out of order |
int |
SMS_RP_CAUSE_OPERATOR_DETERMINED_BARRING
RP-Cause for Operator Barring |
int |
SMS_RP_CAUSE_PROTOCOL_ERROR
RP-Cause Value when network does not provide the received service |
int |
SMS_RP_CAUSE_RESERVED
RP-Cause value for Reserved Number |
int |
SMS_RP_CAUSE_RESOURCES_UNAVAILABLE
RP-Cause Value when Network Resources are unavailable |
int |
SMS_RP_CAUSE_SEMANTICALLY_INCORRECT_MESSAGE
RP-Cause Value when network does not provide the received service |
int |
SMS_RP_CAUSE_SHORT_MESSAGE_TRANSFER_REJECTED
RP-Cause Value for Message Transfer Rejected by Network |
int |
SMS_RP_CAUSE_TEMPORARY_FAILURE
RP-Cause Value For Temporary failure |
int |
SMS_RP_CAUSE_UNALLOCATED_NUMBER
Unallocated Number Cause |
int |
SMS_RP_CAUSE_UNIDENTIFIED_SUBSCRIBER
RP-Cause Value when Subscriber is not Identified |
int |
SMS_RP_CAUSE_UNKNOWN_SUBSCRIBER
RP-Cause Value when Subscriber is not Identified |
int |
STATUS_ON_ICC_FREE
Free space (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27). |
int |
STATUS_ON_ICC_READ
Received and read (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27). |
int |
STATUS_ON_ICC_SENT
Stored and sent (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27). |
int |
STATUS_ON_ICC_UNREAD
Received and unread (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27). |
int |
STATUS_ON_ICC_UNSENT
Stored and unsent (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27). |
Public methods | |
---|---|
String
|
createAppSpecificSmsToken(PendingIntent intent)
Create a single use app specific incoming SMS request for the calling package. |
String
|
createAppSpecificSmsTokenWithPackageInfo(String prefixes, PendingIntent intent)
Create a single use app specific incoming SMS request for the calling package. |
SmsManager
|
createForSubscriptionId(int subId)
Get the instance of the SmsManager associated with a particular subscription ID. |
ArrayList<String>
|
divideMessage(String text)
Divide a message text into several fragments, none bigger than the maximum SMS message size. |
void
|
downloadMultimediaMessage(Context context, String locationUrl, Uri contentUri, Bundle configOverrides, PendingIntent downloadedIntent)
Download an MMS message from carrier by a given location URL Note: If |
void
|
downloadMultimediaMessage(Context context, String locationUrl, Uri contentUri, Bundle configOverrides, PendingIntent downloadedIntent, long messageId)
Download an MMS message from carrier by a given location URL
Same as |
Bundle
|
getCarrierConfigValues()
Get carrier-dependent MMS configuration values. |
static
SmsManager
|
getDefault()
This method was deprecated
in API level 31.
Use |
static
int
|
getDefaultSmsSubscriptionId()
Get default sms subscription id. |
int
|
getSmsCapacityOnIcc()
Gets the total capacity of SMS storage on the SIM card. |
static
SmsManager
|
getSmsManagerForSubscriptionId(int subId)
This method was deprecated
in API level 31.
Use |
void
|
getSmsMessagesForFinancialApp(Bundle params, Executor executor, SmsManager.FinancialSmsCallback callback)
Get SMS messages for the calling financial app. |
String
|
getSmscAddress()
Gets the SMSC address from (U)SIM. |
int
|
getSubscriptionId()
Get the associated subscription id. |
void
|
injectSmsPdu(byte[] pdu, String format, PendingIntent receivedIntent)
Inject an SMS PDU into the android application framework. |
void
|
sendDataMessage(String destinationAddress, String scAddress, short destinationPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent)
Send a data based SMS to a specific application port. |
void
|
sendMultimediaMessage(Context context, Uri contentUri, String locationUrl, Bundle configOverrides, PendingIntent sentIntent)
Send an MMS message Note: If |
void
|
sendMultimediaMessage(Context context, Uri contentUri, String locationUrl, Bundle configOverrides, PendingIntent sentIntent, long messageId)
Send an MMS message
Same as |
void
|
sendMultipartTextMessage(String destinationAddress, String scAddress, List<String> parts, List<PendingIntent> sentIntents, List<PendingIntent> deliveryIntents, long messageId)
Send a multi-part text based SMS. |
void
|
sendMultipartTextMessage(String destinationAddress, String scAddress, ArrayList<String> parts, ArrayList<PendingIntent> sentIntents, ArrayList<PendingIntent> deliveryIntents)
Send a multi-part text based SMS. |
void
|
sendMultipartTextMessage(String destinationAddress, String scAddress, List<String> parts, List<PendingIntent> sentIntents, List<PendingIntent> deliveryIntents, String packageName, String attributionTag)
Similar method as #sendMultipartTextMessage(String, String, ArrayList, ArrayList, ArrayList) With an additional argument. |
void
|
sendTextMessage(String destinationAddress, String scAddress, String text, PendingIntent sentIntent, PendingIntent deliveryIntent, long messageId)
Send a text based SMS. |
void
|
sendTextMessage(String destinationAddress, String scAddress, String text, PendingIntent sentIntent, PendingIntent deliveryIntent)
Send a text based SMS. |
void
|
sendTextMessageWithoutPersisting(String destinationAddress, String scAddress, String text, PendingIntent sentIntent, PendingIntent deliveryIntent)
Send a text based SMS without writing it into the SMS Provider. |
boolean
|
setSmscAddress(String smsc)
Sets the SMSC address on (U)SIM. |
Inherited methods | |||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Constants
EXTRA_MMS_DATA
public static final String EXTRA_MMS_DATA
Intent extra name for MMS sending result data in byte array type
Constant Value: "android.telephony.extra.MMS_DATA"
EXTRA_MMS_HTTP_STATUS
public static final String EXTRA_MMS_HTTP_STATUS
Intent extra name for HTTP status code for MMS HTTP failure in integer type
Constant Value: "android.telephony.extra.MMS_HTTP_STATUS"
MMS_CONFIG_ALIAS_ENABLED
public static final String MMS_CONFIG_ALIAS_ENABLED
Whether alias is enabled (boolean type)
Constant Value: "aliasEnabled"
MMS_CONFIG_ALIAS_MAX_CHARS
public static final String MMS_CONFIG_ALIAS_MAX_CHARS
Max alias character count (int type)
Constant Value: "aliasMaxChars"
MMS_CONFIG_ALIAS_MIN_CHARS
public static final String MMS_CONFIG_ALIAS_MIN_CHARS
Min alias character count (int type)
Constant Value: "aliasMinChars"
MMS_CONFIG_ALLOW_ATTACH_AUDIO
public static final String MMS_CONFIG_ALLOW_ATTACH_AUDIO
Whether audio is allowed to be attached for MMS messages (boolean type)
Constant Value: "allowAttachAudio"
MMS_CONFIG_APPEND_TRANSACTION_ID
public static final String MMS_CONFIG_APPEND_TRANSACTION_ID
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)
Constant Value: "enabledTransID"
MMS_CONFIG_EMAIL_GATEWAY_NUMBER
public static final String MMS_CONFIG_EMAIL_GATEWAY_NUMBER
Email gateway number (String type)
Constant Value: "emailGatewayNumber"
MMS_CONFIG_GROUP_MMS_ENABLED
public static final String MMS_CONFIG_GROUP_MMS_ENABLED
Whether group MMS is enabled for the current carrier (boolean type)
Constant Value: "enableGroupMms"
MMS_CONFIG_HTTP_PARAMS
public static final String MMS_CONFIG_HTTP_PARAMS
A list of HTTP headers to add to MMS HTTP request, separated by "|" (String type)
Constant Value: "httpParams"
MMS_CONFIG_HTTP_SOCKET_TIMEOUT
public static final String MMS_CONFIG_HTTP_SOCKET_TIMEOUT
MMS HTTP socket timeout in milliseconds (int type)
Constant Value: "httpSocketTimeout"
MMS_CONFIG_MAX_IMAGE_HEIGHT
public static final String MMS_CONFIG_MAX_IMAGE_HEIGHT
Max MMS image height (int type)
Constant Value: "maxImageHeight"
MMS_CONFIG_MAX_IMAGE_WIDTH
public static final String MMS_CONFIG_MAX_IMAGE_WIDTH
Max MMS image width (int type)
Constant Value: "maxImageWidth"
MMS_CONFIG_MAX_MESSAGE_SIZE
public static final String MMS_CONFIG_MAX_MESSAGE_SIZE
Max MMS message size in bytes (int type)
Constant Value: "maxMessageSize"
MMS_CONFIG_MESSAGE_TEXT_MAX_SIZE
public static final String MMS_CONFIG_MESSAGE_TEXT_MAX_SIZE
Max message text size (int type)
Constant Value: "maxMessageTextSize"
MMS_CONFIG_MMS_DELIVERY_REPORT_ENABLED
public static final String MMS_CONFIG_MMS_DELIVERY_REPORT_ENABLED
Whether MMS delivery report is enabled (boolean type)
Constant Value: "enableMMSDeliveryReports"
MMS_CONFIG_MMS_ENABLED
public static final String MMS_CONFIG_MMS_ENABLED
Whether MMS is enabled for the current carrier (boolean type)
Constant Value: "enabledMMS"
MMS_CONFIG_MMS_READ_REPORT_ENABLED
public static final String MMS_CONFIG_MMS_READ_REPORT_ENABLED
Whether MMS read report is enabled (boolean type)
Constant Value: "enableMMSReadReports"
MMS_CONFIG_MULTIPART_SMS_ENABLED
public static final String MMS_CONFIG_MULTIPART_SMS_ENABLED
Whether multipart SMS is enabled (boolean type)
Constant Value: "enableMultipartSMS"
MMS_CONFIG_NAI_SUFFIX
public static final String MMS_CONFIG_NAI_SUFFIX
The suffix to append to the NAI header value for MMS HTTP request (String type)
Constant Value: "naiSuffix"
MMS_CONFIG_NOTIFY_WAP_MMSC_ENABLED
public static final String MMS_CONFIG_NOTIFY_WAP_MMSC_ENABLED
If this is enabled, M-NotifyResp.ind should be sent to the WAP Push content location instead of the default MMSC (boolean type)
Constant Value: "enabledNotifyWapMMSC"
MMS_CONFIG_RECIPIENT_LIMIT
public static final String MMS_CONFIG_RECIPIENT_LIMIT
Limit of recipients of MMS messages (int type)
Constant Value: "recipientLimit"
MMS_CONFIG_SEND_MULTIPART_SMS_AS_SEPARATE_MESSAGES
public static final String MMS_CONFIG_SEND_MULTIPART_SMS_AS_SEPARATE_MESSAGES
Whether multipart SMS should be sent as separate messages
Constant Value: "sendMultipartSmsAsSeparateMessages"
MMS_CONFIG_SHOW_CELL_BROADCAST_APP_LINKS
public static final String MMS_CONFIG_SHOW_CELL_BROADCAST_APP_LINKS
If true, show the cell broadcast (amber alert) in the SMS settings. Some carriers don't want this shown. (Boolean type)
Constant Value: "config_cellBroadcastAppLinks"
MMS_CONFIG_SMS_DELIVERY_REPORT_ENABLED
public static final String MMS_CONFIG_SMS_DELIVERY_REPORT_ENABLED
Whether SMS delivery report is enabled (boolean type)
Constant Value: "enableSMSDeliveryReports"
MMS_CONFIG_SMS_TO_MMS_TEXT_LENGTH_THRESHOLD
public static final String MMS_CONFIG_SMS_TO_MMS_TEXT_LENGTH_THRESHOLD
Some carriers require SMS to be converted into MMS when text length reaches this threshold (int type)
Constant Value: "smsToMmsTextLengthThreshold"
MMS_CONFIG_SMS_TO_MMS_TEXT_THRESHOLD
public static final String MMS_CONFIG_SMS_TO_MMS_TEXT_THRESHOLD
When the number of parts of a multipart SMS reaches this threshold, it should be converted into an MMS (int type)
Constant Value: "smsToMmsTextThreshold"
MMS_CONFIG_SUBJECT_MAX_LENGTH
public static final String MMS_CONFIG_SUBJECT_MAX_LENGTH
Max message subject length (int type)
Constant Value: "maxSubjectLength"
MMS_CONFIG_SUPPORT_HTTP_CHARSET_HEADER
public static final String MMS_CONFIG_SUPPORT_HTTP_CHARSET_HEADER
Whether the carrier MMSC supports charset field in Content-Type header. If this is false, then we don't add "charset" to "Content-Type"
Constant Value: "supportHttpCharsetHeader"
MMS_CONFIG_SUPPORT_MMS_CONTENT_DISPOSITION
public static final String MMS_CONFIG_SUPPORT_MMS_CONTENT_DISPOSITION
Whether content-disposition field should be expected in an MMS PDU (boolean type)
Constant Value: "supportMmsContentDisposition"
MMS_CONFIG_UA_PROF_TAG_NAME
public static final String MMS_CONFIG_UA_PROF_TAG_NAME
The name of the UA Prof URL HTTP header for MMS HTTP request (String type)
Constant Value: "uaProfTagName"
MMS_CONFIG_UA_PROF_URL
public static final String MMS_CONFIG_UA_PROF_URL
The UA Profile URL header value for MMS HTTP request (String type)
Constant Value: "uaProfUrl"
MMS_CONFIG_USER_AGENT
public static final String MMS_CONFIG_USER_AGENT
The User-Agent header value for MMS HTTP request (String type)
Constant Value: "userAgent"
MMS_ERROR_CONFIGURATION_ERROR
public static final int MMS_ERROR_CONFIGURATION_ERROR
The carrier-dependent configuration values could not be loaded.
Constant Value: 7 (0x00000007)
MMS_ERROR_DATA_DISABLED
public static final int MMS_ERROR_DATA_DISABLED
Data is disabled for the MMS APN.
Constant Value: 11 (0x0000000b)
MMS_ERROR_HTTP_FAILURE
public static final int MMS_ERROR_HTTP_FAILURE
An error occurred during the HTTP client setup.
Constant Value: 4 (0x00000004)
MMS_ERROR_INACTIVE_SUBSCRIPTION
public static final int MMS_ERROR_INACTIVE_SUBSCRIPTION
The subscription id for the send/download is inactive.
Constant Value: 10 (0x0000000a)
MMS_ERROR_INVALID_APN
public static final int MMS_ERROR_INVALID_APN
ApnException occurred during MMS network setup.
Constant Value: 2 (0x00000002)
MMS_ERROR_INVALID_SUBSCRIPTION_ID
public static final int MMS_ERROR_INVALID_SUBSCRIPTION_ID
The subscription id for the send/download is invalid.
Constant Value: 9 (0x00000009)
MMS_ERROR_IO_ERROR
public static final int MMS_ERROR_IO_ERROR
An I/O error occurred reading the PDU.
Constant Value: 5 (0x00000005)
MMS_ERROR_MMS_DISABLED_BY_CARRIER
public static final int MMS_ERROR_MMS_DISABLED_BY_CARRIER
MMS is disabled by a carrier.
Constant Value: 12 (0x0000000c)
MMS_ERROR_NO_DATA_NETWORK
public static final int MMS_ERROR_NO_DATA_NETWORK
There is neither Wi-Fi nor mobile data network.
Constant Value: 8 (0x00000008)
MMS_ERROR_RETRY
public static final int MMS_ERROR_RETRY
An error occurred while retrying sending/downloading the MMS.
Constant Value: 6 (0x00000006)
MMS_ERROR_UNABLE_CONNECT_MMS
public static final int MMS_ERROR_UNABLE_CONNECT_MMS
An error occurred during the MMS connection setup.
Constant Value: 3 (0x00000003)
MMS_ERROR_UNSPECIFIED
public static final int MMS_ERROR_UNSPECIFIED
Unspecific MMS error occurred during send/download.
Constant Value: 1 (0x00000001)
RESULT_BLUETOOTH_DISCONNECTED
public static final int RESULT_BLUETOOTH_DISCONNECTED
Failed sending via bluetooth because bluetooth disconnected
Constant Value: 27 (0x0000001b)
RESULT_CANCELLED
public static final int RESULT_CANCELLED
Failed because the operation was cancelled
Constant Value: 23 (0x00000017)
RESULT_ENCODING_ERROR
public static final int RESULT_ENCODING_ERROR
Failed because of an encoding error
Constant Value: 18 (0x00000012)
RESULT_ERROR_FDN_CHECK_FAILURE
public static final int RESULT_ERROR_FDN_CHECK_FAILURE
Failed because FDN is enabled.
Constant Value: 6 (0x00000006)
RESULT_ERROR_GENERIC_FAILURE
public static final int RESULT_ERROR_GENERIC_FAILURE
Generic failure cause
Constant Value: 1 (0x00000001)
RESULT_ERROR_LIMIT_EXCEEDED
public static final int RESULT_ERROR_LIMIT_EXCEEDED
Failed because we reached the sending queue limit.
Constant Value: 5 (0x00000005)
RESULT_ERROR_NONE
public static final int RESULT_ERROR_NONE
No error.
Constant Value: 0 (0x00000000)
RESULT_ERROR_NO_SERVICE
public static final int RESULT_ERROR_NO_SERVICE
Failed because service is currently unavailable
Constant Value: 4 (0x00000004)
RESULT_ERROR_NULL_PDU
public static final int RESULT_ERROR_NULL_PDU
Failed because no pdu provided
Constant Value: 3 (0x00000003)
RESULT_ERROR_RADIO_OFF
public static final int RESULT_ERROR_RADIO_OFF
Failed because radio was explicitly turned off
Constant Value: 2 (0x00000002)
RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED
public static final int RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED
Failed because the user has denied this app ever send premium short codes.
Constant Value: 8 (0x00000008)
RESULT_ERROR_SHORT_CODE_NOT_ALLOWED
public static final int RESULT_ERROR_SHORT_CODE_NOT_ALLOWED
Failed because user denied the sending of this short code.
Constant Value: 7 (0x00000007)
RESULT_INTERNAL_ERROR
public static final int RESULT_INTERNAL_ERROR
Failed because of an internal error
Constant Value: 21 (0x00000015)
RESULT_INVALID_ARGUMENTS
public static final int RESULT_INVALID_ARGUMENTS
Failed because of invalid arguments
Constant Value: 11 (0x0000000b)
RESULT_INVALID_BLUETOOTH_ADDRESS
public static final int RESULT_INVALID_BLUETOOTH_ADDRESS
Failed sending via bluetooth because the bluetooth device address is invalid
Constant Value: 26 (0x0000001a)
RESULT_INVALID_SMSC_ADDRESS
public static final int RESULT_INVALID_SMSC_ADDRESS
Failed because of an invalid smsc address
Constant Value: 19 (0x00000013)
RESULT_INVALID_SMS_FORMAT
public static final int RESULT_INVALID_SMS_FORMAT
Failed because the sms format is not valid
Constant Value: 14 (0x0000000e)
RESULT_INVALID_STATE
public static final int RESULT_INVALID_STATE
Failed because of an invalid state
Constant Value: 12 (0x0000000c)
RESULT_MODEM_ERROR
public static final int RESULT_MODEM_ERROR
Failed because of a modem error
Constant Value: 16 (0x00000010)
RESULT_NETWORK_ERROR
public static final int RESULT_NETWORK_ERROR
Failed because of a network error
Constant Value: 17 (0x00000011)
RESULT_NETWORK_REJECT
public static final int RESULT_NETWORK_REJECT
Failed because of network rejection
Constant Value: 10 (0x0000000a)
RESULT_NO_BLUETOOTH_SERVICE
public static final int RESULT_NO_BLUETOOTH_SERVICE
Failed sending via bluetooth because the bluetooth service is not available
Constant Value: 25 (0x00000019)
RESULT_NO_DEFAULT_SMS_APP
public static final int RESULT_NO_DEFAULT_SMS_APP
Set by BroadcastReceiver to indicate there's no default sms app.
Constant Value: 32 (0x00000020)
RESULT_NO_MEMORY
public static final int RESULT_NO_MEMORY
Failed because there is no memory
Constant Value: 13 (0x0000000d)
RESULT_NO_RESOURCES
public static final int RESULT_NO_RESOURCES
Failed because there are no resources
Constant Value: 22 (0x00000016)
RESULT_OPERATION_NOT_ALLOWED
public static final int RESULT_OPERATION_NOT_ALLOWED
Failed because the operation is not allowed
Constant Value: 20 (0x00000014)
RESULT_RADIO_NOT_AVAILABLE
public static final int RESULT_RADIO_NOT_AVAILABLE
Failed because the radio was not available
Constant Value: 9 (0x00000009)
RESULT_RECEIVE_DISPATCH_FAILURE
public static final int RESULT_RECEIVE_DISPATCH_FAILURE
SMS receive dispatch failure.
Constant Value: 500 (0x000001f4)
RESULT_RECEIVE_INJECTED_NULL_PDU
public static final int RESULT_RECEIVE_INJECTED_NULL_PDU
SMS receive injected null PDU.
Constant Value: 501 (0x000001f5)
RESULT_RECEIVE_NULL_MESSAGE_FROM_RIL
public static final int RESULT_RECEIVE_NULL_MESSAGE_FROM_RIL
SMS received null message from the radio interface layer.
Constant Value: 503 (0x000001f7)
RESULT_RECEIVE_RUNTIME_EXCEPTION
public static final int RESULT_RECEIVE_RUNTIME_EXCEPTION
SMS receive encountered runtime exception.
Constant Value: 502 (0x000001f6)
RESULT_RECEIVE_SQL_EXCEPTION
public static final int RESULT_RECEIVE_SQL_EXCEPTION
SMS receive encountered an SQL exception.
Constant Value: 505 (0x000001f9)
RESULT_RECEIVE_URI_EXCEPTION
public static final int RESULT_RECEIVE_URI_EXCEPTION
SMS receive an exception parsing a uri.
Constant Value: 506 (0x000001fa)
RESULT_RECEIVE_WHILE_ENCRYPTED
public static final int RESULT_RECEIVE_WHILE_ENCRYPTED
SMS short code received while the phone is in encrypted state.
Constant Value: 504 (0x000001f8)
RESULT_REMOTE_EXCEPTION
public static final int RESULT_REMOTE_EXCEPTION
Set by BroadcastReceiver to indicate a remote exception while handling a message.
Constant Value: 31 (0x0000001f)
RESULT_REQUEST_NOT_SUPPORTED
public static final int RESULT_REQUEST_NOT_SUPPORTED
Failed because the request is not supported
Constant Value: 24 (0x00000018)
RESULT_RIL_ABORTED
public static final int RESULT_RIL_ABORTED
Operation aborted
Constant Value: 137 (0x00000089)
RESULT_RIL_ACCESS_BARRED
public static final int RESULT_RIL_ACCESS_BARRED
Access is barred.
Constant Value: 122 (0x0000007a)
RESULT_RIL_BLOCKED_DUE_TO_CALL
public static final int RESULT_RIL_BLOCKED_DUE_TO_CALL
SMS is blocked due to call control, e.g., resource unavailable in the SMR entity.
Constant Value: 123 (0x0000007b)
RESULT_RIL_CANCELLED
public static final int RESULT_RIL_CANCELLED
The request has been cancelled.
Constant Value: 119 (0x00000077)
RESULT_RIL_DEVICE_IN_USE
public static final int RESULT_RIL_DEVICE_IN_USE
Operation cannot be performed because the device is currently in use
Constant Value: 136 (0x00000088)
RESULT_RIL_ENCODING_ERR
public static final int RESULT_RIL_ENCODING_ERR
The SMS message was not encoded properly.
Constant Value: 109 (0x0000006d)
RESULT_RIL_GENERIC_ERROR
public static final int RESULT_RIL_GENERIC_ERROR
A RIL error occurred during the SMS send.
Constant Value: 124 (0x0000007c)
RESULT_RIL_INTERNAL_ERR
public static final int RESULT_RIL_INTERNAL_ERR
The modem encountered an unexpected error scenario while handling the request.
Constant Value: 113 (0x00000071)
RESULT_RIL_INVALID_ARGUMENTS
public static final int RESULT_RIL_INVALID_ARGUMENTS
The radio received invalid arguments in the request.
Constant Value: 104 (0x00000068)
RESULT_RIL_INVALID_MODEM_STATE
public static final int RESULT_RIL_INVALID_MODEM_STATE
The radio cannot process the request in the current modem state.
Constant Value: 115 (0x00000073)
RESULT_RIL_INVALID_RESPONSE
public static final int RESULT_RIL_INVALID_RESPONSE
A RIL internal error when one of the RIL layers receives an unrecognized response from a lower layer.
Constant Value: 125 (0x0000007d)
RESULT_RIL_INVALID_SIM_STATE
public static final int RESULT_RIL_INVALID_SIM_STATE
Cannot process the request in current SIM state
Constant Value: 130 (0x00000082)
RESULT_RIL_INVALID_SMSC_ADDRESS
public static final int RESULT_RIL_INVALID_SMSC_ADDRESS
The specified SMSC address was invalid.
Constant Value: 110 (0x0000006e)
RESULT_RIL_INVALID_SMS_FORMAT
public static final int RESULT_RIL_INVALID_SMS_FORMAT
The radio returned an error indicating invalid sms format.
Constant Value: 107 (0x0000006b)
RESULT_RIL_INVALID_STATE
public static final int RESULT_RIL_INVALID_STATE
The radio returned an unexpected request for the current state.
Constant Value: 103 (0x00000067)
RESULT_RIL_MODEM_ERR
public static final int RESULT_RIL_MODEM_ERR
The vendor RIL received an unexpected or incorrect response.
Constant Value: 111 (0x0000006f)
RESULT_RIL_NETWORK_ERR
public static final int RESULT_RIL_NETWORK_ERR
The radio received an error from the network.
Constant Value: 112 (0x00000070)
RESULT_RIL_NETWORK_NOT_READY
public static final int RESULT_RIL_NETWORK_NOT_READY
The network is not ready to perform the request.
Constant Value: 116 (0x00000074)
RESULT_RIL_NETWORK_REJECT
public static final int RESULT_RIL_NETWORK_REJECT
The sms request was rejected by the network.
Constant Value: 102 (0x00000066)
RESULT_RIL_NO_MEMORY
public static final int RESULT_RIL_NO_MEMORY
The radio didn't have sufficient memory to process the request.
Constant Value: 105 (0x00000069)
RESULT_RIL_NO_NETWORK_FOUND
public static final int RESULT_RIL_NO_NETWORK_FOUND
Network cannot be found
Constant Value: 135 (0x00000087)
RESULT_RIL_NO_RESOURCES
public static final int RESULT_RIL_NO_RESOURCES
There are insufficient resources to process the request.
Constant Value: 118 (0x00000076)
RESULT_RIL_NO_SMS_TO_ACK
public static final int RESULT_RIL_NO_SMS_TO_ACK
ACK received when there is no SMS to ack
Constant Value: 131 (0x00000083)
RESULT_RIL_NO_SUBSCRIPTION
public static final int RESULT_RIL_NO_SUBSCRIPTION
Device does not have subscription
Constant Value: 134 (0x00000086)
RESULT_RIL_OPERATION_NOT_ALLOWED
public static final int RESULT_RIL_OPERATION_NOT_ALLOWED
The radio reports the request is not allowed.
Constant Value: 117 (0x00000075)
RESULT_RIL_RADIO_NOT_AVAILABLE
public static final int RESULT_RIL_RADIO_NOT_AVAILABLE
The radio did not start or is resetting.
Constant Value: 100 (0x00000064)
RESULT_RIL_REQUEST_NOT_SUPPORTED
public static final int RESULT_RIL_REQUEST_NOT_SUPPORTED
The request was not supported by the radio.
Constant Value: 114 (0x00000072)
RESULT_RIL_REQUEST_RATE_LIMITED
public static final int RESULT_RIL_REQUEST_RATE_LIMITED
The radio denied the operation due to overly-frequent requests.
Constant Value: 106 (0x0000006a)
RESULT_RIL_SIMULTANEOUS_SMS_AND_CALL_NOT_ALLOWED
public static final int RESULT_RIL_SIMULTANEOUS_SMS_AND_CALL_NOT_ALLOWED
1X voice and SMS are not allowed simultaneously.
Constant Value: 121 (0x00000079)
RESULT_RIL_SIM_ABSENT
public static final int RESULT_RIL_SIM_ABSENT
The radio failed to set the location where the CDMA subscription can be retrieved because the SIM or RUIM is absent.
Constant Value: 120 (0x00000078)
RESULT_RIL_SIM_BUSY
public static final int RESULT_RIL_SIM_BUSY
SIM is busy
Constant Value: 132 (0x00000084)
RESULT_RIL_SIM_ERROR
public static final int RESULT_RIL_SIM_ERROR
Received error from SIM card
Constant Value: 129 (0x00000081)
RESULT_RIL_SIM_FULL
public static final int RESULT_RIL_SIM_FULL
The target EF is full
Constant Value: 133 (0x00000085)
RESULT_RIL_SIM_PIN2
public static final int RESULT_RIL_SIM_PIN2
Operation requires SIM PIN2 to be entered
Constant Value: 126 (0x0000007e)
RESULT_RIL_SIM_PUK2
public static final int RESULT_RIL_SIM_PUK2
Operation requires SIM PUK2 to be entered
Constant Value: 127 (0x0000007f)
RESULT_RIL_SMS_SEND_FAIL_RETRY
public static final int RESULT_RIL_SMS_SEND_FAIL_RETRY
The radio failed to send the sms and needs to retry.
Constant Value: 101 (0x00000065)
RESULT_RIL_SUBSCRIPTION_NOT_AVAILABLE
public static final int RESULT_RIL_SUBSCRIPTION_NOT_AVAILABLE
Fail to find CDMA subscription from specified location
Constant Value: 128 (0x00000080)
RESULT_RIL_SYSTEM_ERR
public static final int RESULT_RIL_SYSTEM_ERR
The radio encountered a platform or system error.
Constant Value: 108 (0x0000006c)
RESULT_SMS_BLOCKED_DURING_EMERGENCY
public static final int RESULT_SMS_BLOCKED_DURING_EMERGENCY
Failed sending during an emergency call
Constant Value: 29 (0x0000001d)
RESULT_SMS_SEND_RETRY_FAILED
public static final int RESULT_SMS_SEND_RETRY_FAILED
Failed to send an sms retry
Constant Value: 30 (0x0000001e)
RESULT_SYSTEM_ERROR
public static final int RESULT_SYSTEM_ERROR
Failed because of a system error
Constant Value: 15 (0x0000000f)
RESULT_UNEXPECTED_EVENT_STOP_SENDING
public static final int RESULT_UNEXPECTED_EVENT_STOP_SENDING
Failed sending because the user denied or canceled the dialog displayed for a premium shortcode sms or rate-limited sms.
Constant Value: 28 (0x0000001c)
RESULT_USER_NOT_ALLOWED
public static final int RESULT_USER_NOT_ALLOWED
User is not associated with the subscription.
Constant Value: 33 (0x00000021)
SMS_RP_CAUSE_CALL_BARRING
public static final int SMS_RP_CAUSE_CALL_BARRING
RP-Cause Value for Call Barring
Constant Value: 10 (0x0000000a)
SMS_RP_CAUSE_CONGESTION
public static final int SMS_RP_CAUSE_CONGESTION
RP-Cause Value for SMS Failure due to Congestion in network
Constant Value: 42 (0x0000002a)
SMS_RP_CAUSE_DESTINATION_OUT_OF_ORDER
public static final int SMS_RP_CAUSE_DESTINATION_OUT_OF_ORDER
RP-Cause Value for Destination is Out of Order
Constant Value: 27 (0x0000001b)
SMS_RP_CAUSE_FACILITY_NOT_IMPLEMENTED
public static final int SMS_RP_CAUSE_FACILITY_NOT_IMPLEMENTED
RP-Cause Value when network does not provide the received service
Constant Value: 69 (0x00000045)
SMS_RP_CAUSE_FACILITY_NOT_SUBSCRIBED
public static final int SMS_RP_CAUSE_FACILITY_NOT_SUBSCRIBED
RP-Cause Value when SMS Facilty is not subscribed by Reote device
Constant Value: 50 (0x00000032)
SMS_RP_CAUSE_FACILITY_REJECTED
public static final int SMS_RP_CAUSE_FACILITY_REJECTED
RP-Cause Value when SMS Facility if Rejected by Operator
Constant Value: 29 (0x0000001d)
SMS_RP_CAUSE_INFORMATION_ELEMENT_NON_EXISTENT
public static final int SMS_RP_CAUSE_INFORMATION_ELEMENT_NON_EXISTENT
RP-Cause Value when network does not provide the received service
Constant Value: 99 (0x00000063)
SMS_RP_CAUSE_INTERWORKING_UNSPECIFIED
public static final int SMS_RP_CAUSE_INTERWORKING_UNSPECIFIED
RP-Cause Value when network does not provide the received service
Constant Value: 127 (0x0000007f)
SMS_RP_CAUSE_INVALID_MANDATORY_INFORMATION
public static final int SMS_RP_CAUSE_INVALID_MANDATORY_INFORMATION
RP-Cause Value when network does not provide the received service
Constant Value: 96 (0x00000060)
SMS_RP_CAUSE_INVALID_MESSAGE_REFERENCE_VALUE
public static final int SMS_RP_CAUSE_INVALID_MESSAGE_REFERENCE_VALUE
RP-Cause Value when RP-MessageRefere
Constant Value: 81 (0x00000051)
SMS_RP_CAUSE_MESSAGE_INCOMPATIBLE_WITH_PROTOCOL_STATE
public static final int SMS_RP_CAUSE_MESSAGE_INCOMPATIBLE_WITH_PROTOCOL_STATE
RP-Cause Value when network does not provide the received service
Constant Value: 98 (0x00000062)
SMS_RP_CAUSE_MESSAGE_TYPE_NON_EXISTENT
public static final int SMS_RP_CAUSE_MESSAGE_TYPE_NON_EXISTENT
RP-Cause Value when network does not provide the received service
Constant Value: 97 (0x00000061)
SMS_RP_CAUSE_NETWORK_OUT_OF_ORDER
public static final int SMS_RP_CAUSE_NETWORK_OUT_OF_ORDER
RP-Cause Value when network is out of order
Constant Value: 38 (0x00000026)
SMS_RP_CAUSE_OPERATOR_DETERMINED_BARRING
public static final int SMS_RP_CAUSE_OPERATOR_DETERMINED_BARRING
RP-Cause for Operator Barring
Constant Value: 8 (0x00000008)
SMS_RP_CAUSE_PROTOCOL_ERROR
public static final int SMS_RP_CAUSE_PROTOCOL_ERROR
RP-Cause Value when network does not provide the received service
Constant Value: 111 (0x0000006f)
SMS_RP_CAUSE_RESERVED
public static final int SMS_RP_CAUSE_RESERVED
RP-Cause value for Reserved Number
Constant Value: 11 (0x0000000b)
SMS_RP_CAUSE_RESOURCES_UNAVAILABLE
public static final int SMS_RP_CAUSE_RESOURCES_UNAVAILABLE
RP-Cause Value when Network Resources are unavailable
Constant Value: 47 (0x0000002f)
SMS_RP_CAUSE_SEMANTICALLY_INCORRECT_MESSAGE
public static final int SMS_RP_CAUSE_SEMANTICALLY_INCORRECT_MESSAGE
RP-Cause Value when network does not provide the received service
Constant Value: 95 (0x0000005f)
SMS_RP_CAUSE_SHORT_MESSAGE_TRANSFER_REJECTED
public static final int SMS_RP_CAUSE_SHORT_MESSAGE_TRANSFER_REJECTED
RP-Cause Value for Message Transfer Rejected by Network
Constant Value: 21 (0x00000015)
SMS_RP_CAUSE_TEMPORARY_FAILURE
public static final int SMS_RP_CAUSE_TEMPORARY_FAILURE
RP-Cause Value For Temporary failure
Constant Value: 41 (0x00000029)
SMS_RP_CAUSE_UNALLOCATED_NUMBER
public static final int SMS_RP_CAUSE_UNALLOCATED_NUMBER
Unallocated Number Cause
Constant Value: 1 (0x00000001)
SMS_RP_CAUSE_UNIDENTIFIED_SUBSCRIBER
public static final int SMS_RP_CAUSE_UNIDENTIFIED_SUBSCRIBER
RP-Cause Value when Subscriber is not Identified
Constant Value: 28 (0x0000001c)
SMS_RP_CAUSE_UNKNOWN_SUBSCRIBER
public static final int SMS_RP_CAUSE_UNKNOWN_SUBSCRIBER
RP-Cause Value when Subscriber is not Identified
Constant Value: 30 (0x0000001e)
STATUS_ON_ICC_FREE
public static final int STATUS_ON_ICC_FREE
Free space (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27).
Constant Value: 0 (0x00000000)
STATUS_ON_ICC_READ
public static final int STATUS_ON_ICC_READ
Received and read (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27).
Constant Value: 1 (0x00000001)
STATUS_ON_ICC_SENT
public static final int STATUS_ON_ICC_SENT
Stored and sent (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27).
Constant Value: 5 (0x00000005)
STATUS_ON_ICC_UNREAD
public static final int STATUS_ON_ICC_UNREAD
Received and unread (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27).
Constant Value: 3 (0x00000003)
STATUS_ON_ICC_UNSENT
public static final int STATUS_ON_ICC_UNSENT
Stored and unsent (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27).
Constant Value: 7 (0x00000007)
Public methods
createAppSpecificSmsToken
public String createAppSpecificSmsToken (PendingIntent intent)
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)
.
Parameters | |
---|---|
intent |
PendingIntent |
Returns | |
---|---|
String |
Token to include in an SMS message. The token will be 11 characters long. |
Throws | |
---|---|
UnsupportedOperationException |
If the device does not have
PackageManager#FEATURE_TELEPHONY_MESSAGING . |
createAppSpecificSmsTokenWithPackageInfo
public String createAppSpecificSmsTokenWithPackageInfo (String prefixes, PendingIntent intent)
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 . |
Returns | |
---|---|
String |
Token to include in an SMS message.
This value may be null . |
Throws | |
---|---|
UnsupportedOperationException |
If the device does not have
PackageManager#FEATURE_TELEPHONY_MESSAGING . |
createForSubscriptionId
public SmsManager createForSubscriptionId (int subId)
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 |
Returns | |
---|---|
SmsManager |
the instance of the SmsManager associated with subscription
This value cannot be null . |
divideMessage
public ArrayList<String> divideMessage (String text)
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. |
Throws | |
---|---|
IllegalArgumentException |
if text is null. |
downloadMultimediaMessage
public void downloadMultimediaMessage (Context context, String locationUrl, Uri contentUri, Bundle configOverrides, PendingIntent downloadedIntent)
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 |
Throws | |
---|---|
IllegalArgumentException |
if locationUrl or contentUri is empty |
UnsupportedOperationException |
If the device does not have
PackageManager#FEATURE_TELEPHONY_MESSAGING . |
downloadMultimediaMessage
public void downloadMultimediaMessage (Context context, String locationUrl, Uri contentUri, Bundle configOverrides, PendingIntent downloadedIntent, long messageId)
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. |
Throws | |
---|---|
IllegalArgumentException |
if locationUrl or contentUri is empty |
UnsupportedOperationException |
If the device does not have
PackageManager#FEATURE_TELEPHONY_MESSAGING . |
getCarrierConfigValues
public Bundle getCarrierConfigValues ()
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)
.
Returns | |
---|---|
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 . |
Throws | |
---|---|
UnsupportedOperationException |
If the device does not have
PackageManager#FEATURE_TELEPHONY_MESSAGING . |
getDefault
public static SmsManager getDefault ()
This method was deprecated
in API level 31.
Use Context.getSystemService(SmsManager.class)
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.
Returns | |
---|---|
SmsManager |
the SmsManager associated with the default subscription id. |
getDefaultSmsSubscriptionId
public static int getDefaultSmsSubscriptionId ()
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)
.
Returns | |
---|---|
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 . |
Throws | |
---|---|
UnsupportedOperationException |
If the device does not have
PackageManager#FEATURE_TELEPHONY_MESSAGING . |
getSmsCapacityOnIcc
public int getSmsCapacityOnIcc ()
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
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)
.
Returns | |
---|---|
int |
the total number of SMS records which can be stored on the SIM card. Value is 0 or greater |
Throws | |
---|---|
UnsupportedOperationException |
If the device does not have
PackageManager#FEATURE_TELEPHONY_MESSAGING . |
getSmsManagerForSubscriptionId
public static SmsManager getSmsManagerForSubscriptionId (int subId)
This method was deprecated
in API level 31.
Use Context.getSystemService(SmsManager.class)
.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 |
Returns | |
---|---|
SmsManager |
the instance of the SmsManager associated with subscription |
getSmsMessagesForFinancialApp
public void getSmsMessagesForFinancialApp (Bundle params, Executor executor, SmsManager.FinancialSmsCallback callback)
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
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
public String getSmscAddress ()
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)
.
Returns | |
---|---|
String |
the SMSC address string, null if failed. |
Throws | |
---|---|
UnsupportedOperationException |
If the device does not have
PackageManager#FEATURE_TELEPHONY_MESSAGING . |
getSubscriptionId
public int getSubscriptionId ()
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)
.
Returns | |
---|---|
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. |
Throws | |
---|---|
UnsupportedOperationException |
If the device does not have
PackageManager#FEATURE_TELEPHONY_MESSAGING . |
injectSmsPdu
public void injectSmsPdu (byte[] pdu, String format, PendingIntent receivedIntent)
Inject an SMS PDU into the android application framework.
Requires permission: Manifest.permission.MODIFY_PHONE_STATE
or carrier
privileges per 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 |
byte : 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 SmsMessage.FORMAT_3GPP , or 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 Telephony.Sms.Intents.RESULT_SMS_HANDLED
for success, or Telephony.Sms.Intents.RESULT_SMS_GENERIC_ERROR or
RESULT_REMOTE_EXCEPTION for error. |
Throws | |
---|---|
IllegalArgumentException |
if the format is invalid. |
UnsupportedOperationException |
If the device does not have
PackageManager#FEATURE_TELEPHONY_MESSAGING . |
sendDataMessage
public void sendDataMessage (String destinationAddress, String scAddress, short destinationPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent)
Send a data based SMS to a specific application port.
Note: Using this method requires that your app has the
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 |
byte : 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"). |
Throws | |
---|---|
IllegalArgumentException |
if destinationAddress or data are empty |
UnsupportedOperationException |
If the device does not have
PackageManager#FEATURE_TELEPHONY_MESSAGING . |
sendMultimediaMessage
public void sendMultimediaMessage (Context context, Uri contentUri, String locationUrl, Bundle configOverrides, PendingIntent sentIntent)
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 |
Throws | |
---|---|
IllegalArgumentException |
if contentUri is empty |
UnsupportedOperationException |
If the device does not have
PackageManager#FEATURE_TELEPHONY_MESSAGING . |
sendMultimediaMessage
public void sendMultimediaMessage (Context context, Uri contentUri, String locationUrl, Bundle configOverrides, PendingIntent sentIntent, long messageId)
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. |
Throws | |
---|---|
IllegalArgumentException |
if contentUri is empty |
UnsupportedOperationException |
If the device does not have
PackageManager#FEATURE_TELEPHONY_MESSAGING . |
sendMultipartTextMessage
public void sendMultipartTextMessage (String destinationAddress, String scAddress, List<String> parts, List<PendingIntent> sentIntents, List<PendingIntent> deliveryIntents, long messageId)
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 | |
---|---|
destinationAddress |
String : This value cannot be null . |
scAddress |
String : This value may be null . |
parts |
List : This value cannot be null . |
sentIntents |
List : This value may be null . |
deliveryIntents |
List : 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. |
Throws | |
---|---|
IllegalArgumentException |
if destinationAddress or data are empty |
UnsupportedOperationException |
If the device does not have
PackageManager#FEATURE_TELEPHONY_MESSAGING . |
sendMultipartTextMessage
public void sendMultipartTextMessage (String destinationAddress, String scAddress, ArrayList<String> parts, ArrayList<PendingIntent> sentIntents, ArrayList<PendingIntent> deliveryIntents)
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
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 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 : an ArrayList of strings that, in order,
comprise the original message |
sentIntents |
ArrayList : if not null, an ArrayList of
PendingIntent s (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 : if not null, an ArrayList of
PendingIntent s (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"). |
Throws | |
---|---|
IllegalArgumentException |
if destinationAddress or data are empty |
UnsupportedOperationException |
If the device does not have
PackageManager#FEATURE_TELEPHONY_MESSAGING . |
sendMultipartTextMessage
public void sendMultipartTextMessage (String destinationAddress, String scAddress, List<String> parts, List<PendingIntent> sentIntents, List<PendingIntent> deliveryIntents, String packageName, String attributionTag)
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 | |
---|---|
destinationAddress |
String : This value cannot be null . |
scAddress |
String : This value may be null . |
parts |
List : This value cannot be null . |
sentIntents |
List : This value may be null . |
deliveryIntents |
List : This value may be null . |
packageName |
String : serves as the default package name if the package name that is
associated with the user id is null. |
attributionTag |
String : This value may be null . |
Throws | |
---|---|
UnsupportedOperationException |
If the device does not have
PackageManager#FEATURE_TELEPHONY_MESSAGING . |
sendTextMessage
public void sendTextMessage (String destinationAddress, String scAddress, String text, PendingIntent sentIntent, PendingIntent deliveryIntent, long messageId)
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 | |
---|---|
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 . |
messageId |
long : An id that uniquely identifies the message requested to be sent.
Used for logging and diagnostics purposes. The id may be 0. |
Throws | |
---|---|
IllegalArgumentException |
if destinationAddress or text are empty |
UnsupportedOperationException |
If the device does not have
PackageManager#FEATURE_TELEPHONY_MESSAGING . |
sendTextMessage
public void sendTextMessage (String destinationAddress, String scAddress, String text, PendingIntent sentIntent, PendingIntent deliveryIntent)
Send a text based SMS.
Note: Using this method requires that your app has the
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 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"). |
Throws | |
---|---|
IllegalArgumentException |
if destinationAddress or text are empty |
UnsupportedOperationException |
If the device does not have
PackageManager#FEATURE_TELEPHONY_MESSAGING . |
sendTextMessageWithoutPersisting
public void sendTextMessageWithoutPersisting (String destinationAddress, String scAddress, String text, PendingIntent sentIntent, PendingIntent deliveryIntent)
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 Manifest.permission.SEND_SMS
and
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
Manifest.permission.MODIFY_PHONE_STATE
and Manifest.permission.SEND_SMS
Requires the
PackageManager#FEATURE_TELEPHONY_MESSAGING
feature which can be detected using PackageManager.hasSystemFeature(String)
.
Parameters | |
---|---|
destinationAddress |
String |
scAddress |
String |
text |
String |
sentIntent |
PendingIntent |
deliveryIntent |
PendingIntent |
Throws | |
---|---|
UnsupportedOperationException |
If the device does not have
PackageManager#FEATURE_TELEPHONY_MESSAGING . |
setSmscAddress
public boolean setSmscAddress (String smsc)
Sets the SMSC address on (U)SIM.
Note: Using this method requires that your app is the
default SMS application, or has 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
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 . |
Returns | |
---|---|
boolean |
true for success, false otherwise. Failure can be due modem returning an error. |
Throws | |
---|---|
UnsupportedOperationException |
If the device does not have
PackageManager#FEATURE_TELEPHONY_MESSAGING . |