CarrierMessagingService


public abstract class CarrierMessagingService
extends Service

java.lang.Object
   ↳ android.content.Context
     ↳ android.content.ContextWrapper
       ↳ android.app.Service
         ↳ android.service.carrier.CarrierMessagingService


A service that receives calls from the system when new SMS and MMS are sent or received.

To extend this class, you must declare the service in your manifest file with the Manifest.permission.BIND_CARRIER_SERVICES permission and include an intent filter with the SERVICE_INTERFACE action. For example:

 <service android:name=".MyMessagingService"
          android:label="@string/service_name"
          android:permission="android.permission.BIND_CARRIER_SERVICES">
     <intent-filter>
         <action android:name="android.service.carrier.CarrierMessagingService" />
     </intent-filter>
 </service>

Summary

Nested classes

interface CarrierMessagingService.ResultCallback<T>

A callback interface used to provide results asynchronously. 

class CarrierMessagingService.SendMmsResult

The result of sending an MMS. 

class CarrierMessagingService.SendMultipartSmsResult

The result of sending a multipart SMS. 

class CarrierMessagingService.SendSmsResult

The result of sending an SMS. 

Constants

int DOWNLOAD_STATUS_ERROR

MMS downloading failed due to an unspecified issue.

int DOWNLOAD_STATUS_MMS_ERROR_CONFIGURATION_ERROR

The carrier-dependent configuration values could not be loaded.

int DOWNLOAD_STATUS_MMS_ERROR_DATA_DISABLED

Data is disabled for the MMS APN.

int DOWNLOAD_STATUS_MMS_ERROR_HTTP_FAILURE

An error occurred during the HTTP client setup.

int DOWNLOAD_STATUS_MMS_ERROR_INACTIVE_SUBSCRIPTION

The subscription id for the download is inactive.

int DOWNLOAD_STATUS_MMS_ERROR_INVALID_APN

ApnException occurred during MMS network setup.

int DOWNLOAD_STATUS_MMS_ERROR_INVALID_SUBSCRIPTION_ID

The subscription id for the download is invalid.

int DOWNLOAD_STATUS_MMS_ERROR_IO_ERROR

An I/O error occurred reading the PDU.

int DOWNLOAD_STATUS_MMS_ERROR_MMS_DISABLED_BY_CARRIER

MMS is disabled by a carrier.

int DOWNLOAD_STATUS_MMS_ERROR_NO_DATA_NETWORK

There is neither Wi-Fi nor mobile data network.

int DOWNLOAD_STATUS_MMS_ERROR_RETRY

An error occurred while retrying downloading the MMS.

int DOWNLOAD_STATUS_MMS_ERROR_UNABLE_CONNECT_MMS

An error occurred during the MMS connection setup.

int DOWNLOAD_STATUS_MMS_ERROR_UNSPECIFIED

Unspecific MMS error occurred during download.

int DOWNLOAD_STATUS_OK

Successfully downloaded an MMS message.

int DOWNLOAD_STATUS_RETRY_ON_CARRIER_NETWORK

MMS downloading failed.

int RECEIVE_OPTIONS_DEFAULT

The default bitmask value passed to the callback of onReceiveTextSms(MessagePdu, String, int, int, ResultCallback) with all RECEIVE_OPTIONS_x flags cleared to indicate that the message should be kept and a new message notification should be shown.

int RECEIVE_OPTIONS_DROP

Used to set the flag in the bitmask passed to the callback of onReceiveTextSms(MessagePdu, String, int, int, ResultCallback) to indicate that the inbound SMS should be dropped.

int RECEIVE_OPTIONS_SKIP_NOTIFY_WHEN_CREDENTIAL_PROTECTED_STORAGE_UNAVAILABLE

Used to set the flag in the bitmask passed to the callback of onReceiveTextSms(MessagePdu, String, int, int, ResultCallback) to indicate that a new message notification should not be shown to the user when the credential-encrypted storage of the device is not available before the user unlocks the phone.

int SEND_FLAG_REQUEST_DELIVERY_STATUS

Flag to request SMS delivery status report.

int SEND_STATUS_ERROR

SMS/MMS sending failed due to an unspecified issue.

int SEND_STATUS_MMS_ERROR_CONFIGURATION_ERROR

The carrier-dependent configuration values could not be loaded.

int SEND_STATUS_MMS_ERROR_DATA_DISABLED

Data is disabled for the MMS APN.

int SEND_STATUS_MMS_ERROR_HTTP_FAILURE

An error occurred during the HTTP client setup.

int SEND_STATUS_MMS_ERROR_INACTIVE_SUBSCRIPTION

The subscription id for the send is inactive.

int SEND_STATUS_MMS_ERROR_INVALID_APN

ApnException occurred during MMS network setup.

int SEND_STATUS_MMS_ERROR_INVALID_SUBSCRIPTION_ID

The subscription id for the send is invalid.

int SEND_STATUS_MMS_ERROR_IO_ERROR

An I/O error occurred reading the PDU.

int SEND_STATUS_MMS_ERROR_MMS_DISABLED_BY_CARRIER

MMS is disabled by a carrier.

int SEND_STATUS_MMS_ERROR_NO_DATA_NETWORK

There is neither Wi-Fi nor mobile data network.

int SEND_STATUS_MMS_ERROR_RETRY

An error occurred while retrying sending the MMS.

int SEND_STATUS_MMS_ERROR_UNABLE_CONNECT_MMS

An error occurred during the MMS connection setup.

int SEND_STATUS_MMS_ERROR_UNSPECIFIED

Unspecific MMS error occurred during send.

int SEND_STATUS_OK

Indicates that an SMS or MMS message was successfully sent.

int SEND_STATUS_RESULT_CANCELLED

Failed because the operation was cancelled.

int SEND_STATUS_RESULT_ENCODING_ERROR

Failed because of an encoding error.

int SEND_STATUS_RESULT_ERROR_FDN_CHECK_FAILURE

Failed because FDN is enabled.

int SEND_STATUS_RESULT_ERROR_GENERIC_FAILURE

Generic failure cause.

int SEND_STATUS_RESULT_ERROR_LIMIT_EXCEEDED

Failed because we reached the sending queue limit.

int SEND_STATUS_RESULT_ERROR_NO_SERVICE

Failed because service is currently unavailable.

int SEND_STATUS_RESULT_ERROR_NULL_PDU

Failed because no pdu provided.

int SEND_STATUS_RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED

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

int SEND_STATUS_RESULT_ERROR_SHORT_CODE_NOT_ALLOWED

Failed because user denied the sending of this short code.

int SEND_STATUS_RESULT_INVALID_ARGUMENTS

Failed because of invalid arguments.

int SEND_STATUS_RESULT_INVALID_SMSC_ADDRESS

Failed because of an invalid smsc address

int SEND_STATUS_RESULT_INVALID_SMS_FORMAT

Failed because the sms format is not valid.

int SEND_STATUS_RESULT_INVALID_STATE

Failed because of an invalid state.

int SEND_STATUS_RESULT_NETWORK_ERROR

Failed because of a network error.

int SEND_STATUS_RESULT_NETWORK_REJECT

Failed because of network rejection.

int SEND_STATUS_RESULT_OPERATION_NOT_ALLOWED

Failed because the operation is not allowed.

int SEND_STATUS_RESULT_REQUEST_NOT_SUPPORTED

Failed because the request is not supported.

int SEND_STATUS_RESULT_SMS_BLOCKED_DURING_EMERGENCY

Failed sending during an emergency call.

int SEND_STATUS_RESULT_SMS_SEND_RETRY_FAILED

Failed to send an sms retry.

int SEND_STATUS_RETRY_ON_CARRIER_NETWORK

SMS/MMS sending failed.

String SERVICE_INTERFACE

The Intent that must be declared as handled by the service.

Inherited constants

Public constructors

CarrierMessagingService()

Public methods

IBinder onBind(Intent intent)

Return the communication channel to the service.

void onDownloadMms(Uri contentUri, int subId, Uri location, ResultCallback<Integer> callback)

Override this method to download MMSs received.

void onFilterSms(MessagePdu pdu, String format, int destPort, int subId, ResultCallback<Boolean> callback)

This method was deprecated in API level 24. Use onReceiveTextSms(MessagePdu, String, int, int, ResultCallback) instead.

void onReceiveTextSms(MessagePdu pdu, String format, int destPort, int subId, ResultCallback<Integer> callback)

Override this method to filter inbound SMS messages.

void onSendDataSms(byte[] data, int subId, String destAddress, int destPort, ResultCallback<CarrierMessagingService.SendSmsResult> callback)

This method was deprecated in API level 23. Override onSendDataSms(byte, int, String, int, ResultCallback) below instead.

void onSendDataSms(byte[] data, int subId, String destAddress, int destPort, int sendSmsFlag, ResultCallback<CarrierMessagingService.SendSmsResult> callback)

Override this method to intercept binary SMSs sent from the device.

void onSendMms(Uri pduUri, int subId, Uri location, ResultCallback<CarrierMessagingService.SendMmsResult> callback)

Override this method to intercept MMSs sent from the device.

void onSendMultipartTextSms(List<String> parts, int subId, String destAddress, ResultCallback<CarrierMessagingService.SendMultipartSmsResult> callback)

This method was deprecated in API level 23. Override onSendMultipartTextSms(List, int, String, ResultCallback) below instead.

void onSendMultipartTextSms(List<String> parts, int subId, String destAddress, int sendSmsFlag, ResultCallback<CarrierMessagingService.SendMultipartSmsResult> callback)

Override this method to intercept long SMSs sent from the device.

void onSendTextSms(String text, int subId, String destAddress, int sendSmsFlag, ResultCallback<CarrierMessagingService.SendSmsResult> callback)

Override this method to intercept text SMSs sent from the device.

void onSendTextSms(String text, int subId, String destAddress, ResultCallback<CarrierMessagingService.SendSmsResult> callback)

This method was deprecated in API level 23. Override onSendTextSms(String, int, String, ResultCallback) below instead.

Inherited methods

Constants

DOWNLOAD_STATUS_ERROR

Added in API level 22
public static final int DOWNLOAD_STATUS_ERROR

MMS downloading failed due to an unspecified issue. Downloading will not be retried via the carrier network.

Maps to SmsManager.MMR_ERROR_UNSPECIFIED.

Constant Value: 2 (0x00000002)

DOWNLOAD_STATUS_MMS_ERROR_CONFIGURATION_ERROR

public static final int DOWNLOAD_STATUS_MMS_ERROR_CONFIGURATION_ERROR

The carrier-dependent configuration values could not be loaded.

Constant Value: 606 (0x0000025e)

DOWNLOAD_STATUS_MMS_ERROR_DATA_DISABLED

public static final int DOWNLOAD_STATUS_MMS_ERROR_DATA_DISABLED

Data is disabled for the MMS APN.

Constant Value: 610 (0x00000262)

DOWNLOAD_STATUS_MMS_ERROR_HTTP_FAILURE

public static final int DOWNLOAD_STATUS_MMS_ERROR_HTTP_FAILURE

An error occurred during the HTTP client setup.

Constant Value: 603 (0x0000025b)

DOWNLOAD_STATUS_MMS_ERROR_INACTIVE_SUBSCRIPTION

public static final int DOWNLOAD_STATUS_MMS_ERROR_INACTIVE_SUBSCRIPTION

The subscription id for the download is inactive.

Constant Value: 609 (0x00000261)

DOWNLOAD_STATUS_MMS_ERROR_INVALID_APN

public static final int DOWNLOAD_STATUS_MMS_ERROR_INVALID_APN

ApnException occurred during MMS network setup.

Constant Value: 601 (0x00000259)

DOWNLOAD_STATUS_MMS_ERROR_INVALID_SUBSCRIPTION_ID

public static final int DOWNLOAD_STATUS_MMS_ERROR_INVALID_SUBSCRIPTION_ID

The subscription id for the download is invalid.

Constant Value: 608 (0x00000260)

DOWNLOAD_STATUS_MMS_ERROR_IO_ERROR

public static final int DOWNLOAD_STATUS_MMS_ERROR_IO_ERROR

An I/O error occurred reading the PDU.

Constant Value: 604 (0x0000025c)

DOWNLOAD_STATUS_MMS_ERROR_MMS_DISABLED_BY_CARRIER

public static final int DOWNLOAD_STATUS_MMS_ERROR_MMS_DISABLED_BY_CARRIER

MMS is disabled by a carrier.

Constant Value: 611 (0x00000263)

DOWNLOAD_STATUS_MMS_ERROR_NO_DATA_NETWORK

public static final int DOWNLOAD_STATUS_MMS_ERROR_NO_DATA_NETWORK

There is neither Wi-Fi nor mobile data network.

Constant Value: 607 (0x0000025f)

DOWNLOAD_STATUS_MMS_ERROR_RETRY

public static final int DOWNLOAD_STATUS_MMS_ERROR_RETRY

An error occurred while retrying downloading the MMS.

Constant Value: 605 (0x0000025d)

DOWNLOAD_STATUS_MMS_ERROR_UNABLE_CONNECT_MMS

public static final int DOWNLOAD_STATUS_MMS_ERROR_UNABLE_CONNECT_MMS

An error occurred during the MMS connection setup.

Constant Value: 602 (0x0000025a)

DOWNLOAD_STATUS_MMS_ERROR_UNSPECIFIED

public static final int DOWNLOAD_STATUS_MMS_ERROR_UNSPECIFIED

Unspecific MMS error occurred during download.

Constant Value: 600 (0x00000258)

DOWNLOAD_STATUS_OK

Added in API level 22
public static final int DOWNLOAD_STATUS_OK

Successfully downloaded an MMS message.

Constant Value: 0 (0x00000000)

DOWNLOAD_STATUS_RETRY_ON_CARRIER_NETWORK

Added in API level 22
public static final int DOWNLOAD_STATUS_RETRY_ON_CARRIER_NETWORK

MMS downloading failed. We should retry via the carrier network.

Constant Value: 1 (0x00000001)

RECEIVE_OPTIONS_DEFAULT

Added in API level 24
public static final int RECEIVE_OPTIONS_DEFAULT

The default bitmask value passed to the callback of onReceiveTextSms(MessagePdu, String, int, int, ResultCallback) with all RECEIVE_OPTIONS_x flags cleared to indicate that the message should be kept and a new message notification should be shown.

Constant Value: 0 (0x00000000)

RECEIVE_OPTIONS_DROP

Added in API level 24
public static final int RECEIVE_OPTIONS_DROP

Used to set the flag in the bitmask passed to the callback of onReceiveTextSms(MessagePdu, String, int, int, ResultCallback) to indicate that the inbound SMS should be dropped.

Constant Value: 1 (0x00000001)

RECEIVE_OPTIONS_SKIP_NOTIFY_WHEN_CREDENTIAL_PROTECTED_STORAGE_UNAVAILABLE

Added in API level 24
public static final int RECEIVE_OPTIONS_SKIP_NOTIFY_WHEN_CREDENTIAL_PROTECTED_STORAGE_UNAVAILABLE

Used to set the flag in the bitmask passed to the callback of onReceiveTextSms(MessagePdu, String, int, int, ResultCallback) to indicate that a new message notification should not be shown to the user when the credential-encrypted storage of the device is not available before the user unlocks the phone. It is only applicable to devices that support file-based encryption.

Constant Value: 2 (0x00000002)

SEND_FLAG_REQUEST_DELIVERY_STATUS

Added in API level 23
public static final int SEND_FLAG_REQUEST_DELIVERY_STATUS

Flag to request SMS delivery status report.

Constant Value: 1 (0x00000001)

SEND_STATUS_ERROR

Added in API level 22
public static final int SEND_STATUS_ERROR

SMS/MMS sending failed due to an unspecified issue. Sending will not be retried via the carrier network.

Maps to SmsManager.RESULT_RIL_GENERIC_FAILURE for SMS and SmsManager.MMS_ERROR_UNSPECIFIED for MMS.

Constant Value: 2 (0x00000002)

SEND_STATUS_MMS_ERROR_CONFIGURATION_ERROR

public static final int SEND_STATUS_MMS_ERROR_CONFIGURATION_ERROR

The carrier-dependent configuration values could not be loaded.

Constant Value: 406 (0x00000196)

SEND_STATUS_MMS_ERROR_DATA_DISABLED

public static final int SEND_STATUS_MMS_ERROR_DATA_DISABLED

Data is disabled for the MMS APN.

Constant Value: 410 (0x0000019a)

SEND_STATUS_MMS_ERROR_HTTP_FAILURE

public static final int SEND_STATUS_MMS_ERROR_HTTP_FAILURE

An error occurred during the HTTP client setup.

Constant Value: 403 (0x00000193)

SEND_STATUS_MMS_ERROR_INACTIVE_SUBSCRIPTION

public static final int SEND_STATUS_MMS_ERROR_INACTIVE_SUBSCRIPTION

The subscription id for the send is inactive.

Constant Value: 409 (0x00000199)

SEND_STATUS_MMS_ERROR_INVALID_APN

public static final int SEND_STATUS_MMS_ERROR_INVALID_APN

ApnException occurred during MMS network setup.

Constant Value: 401 (0x00000191)

SEND_STATUS_MMS_ERROR_INVALID_SUBSCRIPTION_ID

public static final int SEND_STATUS_MMS_ERROR_INVALID_SUBSCRIPTION_ID

The subscription id for the send is invalid.

Constant Value: 408 (0x00000198)

SEND_STATUS_MMS_ERROR_IO_ERROR

public static final int SEND_STATUS_MMS_ERROR_IO_ERROR

An I/O error occurred reading the PDU.

Constant Value: 404 (0x00000194)

SEND_STATUS_MMS_ERROR_MMS_DISABLED_BY_CARRIER

public static final int SEND_STATUS_MMS_ERROR_MMS_DISABLED_BY_CARRIER

MMS is disabled by a carrier.

Constant Value: 411 (0x0000019b)

SEND_STATUS_MMS_ERROR_NO_DATA_NETWORK

public static final int SEND_STATUS_MMS_ERROR_NO_DATA_NETWORK

There is neither Wi-Fi nor mobile data network.

Constant Value: 407 (0x00000197)

SEND_STATUS_MMS_ERROR_RETRY

public static final int SEND_STATUS_MMS_ERROR_RETRY

An error occurred while retrying sending the MMS.

Constant Value: 405 (0x00000195)

SEND_STATUS_MMS_ERROR_UNABLE_CONNECT_MMS

public static final int SEND_STATUS_MMS_ERROR_UNABLE_CONNECT_MMS

An error occurred during the MMS connection setup.

Constant Value: 402 (0x00000192)

SEND_STATUS_MMS_ERROR_UNSPECIFIED

public static final int SEND_STATUS_MMS_ERROR_UNSPECIFIED

Unspecific MMS error occurred during send.

Constant Value: 400 (0x00000190)

SEND_STATUS_OK

Added in API level 22
public static final int SEND_STATUS_OK

Indicates that an SMS or MMS message was successfully sent.

Constant Value: 0 (0x00000000)

SEND_STATUS_RESULT_CANCELLED

public static final int SEND_STATUS_RESULT_CANCELLED

Failed because the operation was cancelled.

Constant Value: 215 (0x000000d7)

SEND_STATUS_RESULT_ENCODING_ERROR

public static final int SEND_STATUS_RESULT_ENCODING_ERROR

Failed because of an encoding error.

Constant Value: 212 (0x000000d4)

SEND_STATUS_RESULT_ERROR_FDN_CHECK_FAILURE

public static final int SEND_STATUS_RESULT_ERROR_FDN_CHECK_FAILURE

Failed because FDN is enabled.

Constant Value: 204 (0x000000cc)

SEND_STATUS_RESULT_ERROR_GENERIC_FAILURE

public static final int SEND_STATUS_RESULT_ERROR_GENERIC_FAILURE

Generic failure cause.

Constant Value: 200 (0x000000c8)

SEND_STATUS_RESULT_ERROR_LIMIT_EXCEEDED

public static final int SEND_STATUS_RESULT_ERROR_LIMIT_EXCEEDED

Failed because we reached the sending queue limit.

Constant Value: 203 (0x000000cb)

SEND_STATUS_RESULT_ERROR_NO_SERVICE

public static final int SEND_STATUS_RESULT_ERROR_NO_SERVICE

Failed because service is currently unavailable.

Constant Value: 202 (0x000000ca)

SEND_STATUS_RESULT_ERROR_NULL_PDU

public static final int SEND_STATUS_RESULT_ERROR_NULL_PDU

Failed because no pdu provided.

Constant Value: 201 (0x000000c9)

SEND_STATUS_RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED

public static final int SEND_STATUS_RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED

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

Constant Value: 206 (0x000000ce)

SEND_STATUS_RESULT_ERROR_SHORT_CODE_NOT_ALLOWED

public static final int SEND_STATUS_RESULT_ERROR_SHORT_CODE_NOT_ALLOWED

Failed because user denied the sending of this short code.

Constant Value: 205 (0x000000cd)

SEND_STATUS_RESULT_INVALID_ARGUMENTS

public static final int SEND_STATUS_RESULT_INVALID_ARGUMENTS

Failed because of invalid arguments.

Constant Value: 208 (0x000000d0)

SEND_STATUS_RESULT_INVALID_SMSC_ADDRESS

public static final int SEND_STATUS_RESULT_INVALID_SMSC_ADDRESS

Failed because of an invalid smsc address

Constant Value: 213 (0x000000d5)

SEND_STATUS_RESULT_INVALID_SMS_FORMAT

public static final int SEND_STATUS_RESULT_INVALID_SMS_FORMAT

Failed because the sms format is not valid.

Constant Value: 210 (0x000000d2)

SEND_STATUS_RESULT_INVALID_STATE

public static final int SEND_STATUS_RESULT_INVALID_STATE

Failed because of an invalid state.

Constant Value: 209 (0x000000d1)

SEND_STATUS_RESULT_NETWORK_ERROR

public static final int SEND_STATUS_RESULT_NETWORK_ERROR

Failed because of a network error.

Constant Value: 211 (0x000000d3)

SEND_STATUS_RESULT_NETWORK_REJECT

public static final int SEND_STATUS_RESULT_NETWORK_REJECT

Failed because of network rejection.

Constant Value: 207 (0x000000cf)

SEND_STATUS_RESULT_OPERATION_NOT_ALLOWED

public static final int SEND_STATUS_RESULT_OPERATION_NOT_ALLOWED

Failed because the operation is not allowed.

Constant Value: 214 (0x000000d6)

SEND_STATUS_RESULT_REQUEST_NOT_SUPPORTED

public static final int SEND_STATUS_RESULT_REQUEST_NOT_SUPPORTED

Failed because the request is not supported.

Constant Value: 216 (0x000000d8)

SEND_STATUS_RESULT_SMS_BLOCKED_DURING_EMERGENCY

public static final int SEND_STATUS_RESULT_SMS_BLOCKED_DURING_EMERGENCY

Failed sending during an emergency call.

Constant Value: 217 (0x000000d9)

SEND_STATUS_RESULT_SMS_SEND_RETRY_FAILED

public static final int SEND_STATUS_RESULT_SMS_SEND_RETRY_FAILED

Failed to send an sms retry.

Constant Value: 218 (0x000000da)

SEND_STATUS_RETRY_ON_CARRIER_NETWORK

Added in API level 22
public static final int SEND_STATUS_RETRY_ON_CARRIER_NETWORK

SMS/MMS sending failed. We should retry via the carrier network.

Constant Value: 1 (0x00000001)

SERVICE_INTERFACE

Added in API level 22
public static final String SERVICE_INTERFACE

The Intent that must be declared as handled by the service.

Constant Value: "android.service.carrier.CarrierMessagingService"

Public constructors

CarrierMessagingService

public CarrierMessagingService ()

Public methods

onBind

Added in API level 22
public IBinder onBind (Intent intent)

Return the communication channel to the service. May return null if clients can not bind to the service. The returned IBinder is usually for a complex interface that has been described using aidl.

Note that unlike other application components, calls on to the IBinder interface returned here may not happen on the main thread of the process. More information about the main thread can be found in Processes and Threads.

Parameters
intent Intent: This value cannot be null.

Returns
IBinder This value may be null.

onDownloadMms

Added in API level 22
public void onDownloadMms (Uri contentUri, 
                int subId, 
                Uri location, 
                ResultCallback<Integer> callback)

Override this method to download MMSs received.

Parameters
contentUri Uri: the content provider URI of the PDU to be downloaded. This value cannot be null.

subId int: SMS subscription ID of the SIM

location Uri: the URI of the message to be downloaded. This value cannot be null.

callback ResultCallback: result callback. Call with a status code which is one of DOWNLOAD_STATUS_OK, DOWNLOAD_STATUS_RETRY_ON_CARRIER_NETWORK, or DOWNLOAD_STATUS_ERROR. This value cannot be null.

onFilterSms

Added in API level 22
Deprecated in API level 24
public void onFilterSms (MessagePdu pdu, 
                String format, 
                int destPort, 
                int subId, 
                ResultCallback<Boolean> callback)

This method was deprecated in API level 24.
Use onReceiveTextSms(MessagePdu, String, int, int, ResultCallback) instead.

Override this method to filter inbound SMS messages.

Parameters
pdu MessagePdu: the PDUs of the message This value cannot be null.

format String: the format of the PDUs, typically "3gpp" or "3gpp2" This value cannot be null.

destPort int: the destination port of a binary SMS, this will be -1 for text SMS

subId int: SMS subscription ID of the SIM

callback ResultCallback: result callback. Call with true to keep an inbound SMS message and deliver to SMS apps, and false to drop the message. This value cannot be null.

onReceiveTextSms

Added in API level 24
public void onReceiveTextSms (MessagePdu pdu, 
                String format, 
                int destPort, 
                int subId, 
                ResultCallback<Integer> callback)

Override this method to filter inbound SMS messages.

This method will be called once for every incoming text SMS. You can invoke the callback with a bitmask to tell the platform how to handle the SMS. For a SMS received on a file-based encryption capable device while the credential-encrypted storage is not available, this method will be called for the second time when the credential-encrypted storage becomes available after the user unlocks the phone, if the bit RECEIVE_OPTIONS_DROP is not set when invoking the callback.

Parameters
pdu MessagePdu: the PDUs of the message This value cannot be null.

format String: the format of the PDUs, typically "3gpp" or "3gpp2" This value cannot be null.

destPort int: the destination port of a binary SMS, this will be -1 for text SMS

subId int: SMS subscription ID of the SIM

callback ResultCallback: result callback. Call with a bitmask integer to indicate how the incoming text SMS should be handled by the platform. Use RECEIVE_OPTIONS_DROP and RECEIVE_OPTIONS_SKIP_NOTIFY_WHEN_CREDENTIAL_PROTECTED_STORAGE_UNAVAILABLE to set the flags in the bitmask. This value cannot be null.

onSendDataSms

Added in API level 22
Deprecated in API level 23
public void onSendDataSms (byte[] data, 
                int subId, 
                String destAddress, 
                int destPort, 
                ResultCallback<CarrierMessagingService.SendSmsResult> callback)

This method was deprecated in API level 23.
Override onSendDataSms(byte, int, String, int, ResultCallback) below instead.

Override this method to intercept binary SMSs sent from the device.

Parameters
data byte: the binary content This value cannot be null.

subId int: SMS subscription ID of the SIM

destAddress String: phone number of the recipient of the message This value cannot be null.

destPort int: the destination port

callback ResultCallback: result callback. Call with a SendSmsResult. This value cannot be null.

onSendDataSms

Added in API level 23
public void onSendDataSms (byte[] data, 
                int subId, 
                String destAddress, 
                int destPort, 
                int sendSmsFlag, 
                ResultCallback<CarrierMessagingService.SendSmsResult> callback)

Override this method to intercept binary SMSs sent from the device.

Parameters
data byte: the binary content This value cannot be null.

subId int: SMS subscription ID of the SIM

destAddress String: phone number of the recipient of the message This value cannot be null.

destPort int: the destination port

sendSmsFlag int: Flag for sending SMS. Acceptable values are 0 and SEND_FLAG_REQUEST_DELIVERY_STATUS.

callback ResultCallback: result callback. Call with a SendSmsResult. This value cannot be null.

onSendMms

Added in API level 22
public void onSendMms (Uri pduUri, 
                int subId, 
                Uri location, 
                ResultCallback<CarrierMessagingService.SendMmsResult> callback)

Override this method to intercept MMSs sent from the device.

Parameters
pduUri Uri: the content provider URI of the PDU to send This value cannot be null.

subId int: SMS subscription ID of the SIM

location Uri: the optional URI to send this MMS PDU. If this is {code null}, the PDU should be sent to the default MMSC URL.

callback ResultCallback: result callback. Call with a SendMmsResult. This value cannot be null.

onSendMultipartTextSms

Added in API level 22
Deprecated in API level 23
public void onSendMultipartTextSms (List<String> parts, 
                int subId, 
                String destAddress, 
                ResultCallback<CarrierMessagingService.SendMultipartSmsResult> callback)

This method was deprecated in API level 23.
Override onSendMultipartTextSms(List, int, String, ResultCallback) below instead.

Override this method to intercept long SMSs sent from the device.

Parameters
parts List: a List of the message parts This value cannot be null.

subId int: SMS subscription ID of the SIM

destAddress String: phone number of the recipient of the message This value cannot be null.

callback ResultCallback: result callback. Call with a SendMultipartSmsResult. This value cannot be null.

onSendMultipartTextSms

Added in API level 23
public void onSendMultipartTextSms (List<String> parts, 
                int subId, 
                String destAddress, 
                int sendSmsFlag, 
                ResultCallback<CarrierMessagingService.SendMultipartSmsResult> callback)

Override this method to intercept long SMSs sent from the device.

Parameters
parts List: a List of the message parts This value cannot be null.

subId int: SMS subscription ID of the SIM

destAddress String: phone number of the recipient of the message This value cannot be null.

sendSmsFlag int: Flag for sending SMS. Acceptable values are 0 and SEND_FLAG_REQUEST_DELIVERY_STATUS.

callback ResultCallback: result callback. Call with a SendMultipartSmsResult. This value cannot be null.

onSendTextSms

Added in API level 23
public void onSendTextSms (String text, 
                int subId, 
                String destAddress, 
                int sendSmsFlag, 
                ResultCallback<CarrierMessagingService.SendSmsResult> callback)

Override this method to intercept text SMSs sent from the device.

Parameters
text String: the text to send This value cannot be null.

subId int: SMS subscription ID of the SIM

destAddress String: phone number of the recipient of the message This value cannot be null.

sendSmsFlag int: Flag for sending SMS. Acceptable values are 0 and SEND_FLAG_REQUEST_DELIVERY_STATUS.

callback ResultCallback: result callback. Call with a SendSmsResult. This value cannot be null.

onSendTextSms

Added in API level 22
Deprecated in API level 23
public void onSendTextSms (String text, 
                int subId, 
                String destAddress, 
                ResultCallback<CarrierMessagingService.SendSmsResult> callback)

This method was deprecated in API level 23.
Override onSendTextSms(String, int, String, ResultCallback) below instead.

Override this method to intercept text SMSs sent from the device.

Parameters
text String: the text to send This value cannot be null.

subId int: SMS subscription ID of the SIM

destAddress String: phone number of the recipient of the message This value cannot be null.

callback ResultCallback: result callback. Call with a SendSmsResult. This value cannot be null.