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 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>
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
CarrierMessagingService.ResultCallback<T> | A callback interface used to provide results asynchronously. | ||||||||||
CarrierMessagingService.SendMmsResult | The result of sending an MMS. | ||||||||||
CarrierMessagingService.SendMultipartSmsResult | The result of sending a multipart SMS. | ||||||||||
CarrierMessagingService.SendSmsResult | The result of sending an SMS. |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | DOWNLOAD_STATUS_ERROR | MMS downloading failed. | |||||||||
int | DOWNLOAD_STATUS_OK | Successfully downloaded an MMS message. | |||||||||
int | DOWNLOAD_STATUS_RETRY_ON_CARRIER_NETWORK | MMS downloading failed. | |||||||||
int | SEND_FLAG_REQUEST_DELIVERY_STATUS | Flag to request SMS delivery status report. | |||||||||
int | SEND_STATUS_ERROR | SMS/MMS sending failed. | |||||||||
int | SEND_STATUS_OK | Indicates that an SMS or MMS message was successfully sent. | |||||||||
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.
|
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.app.Service
| |||||||||||
From class
android.content.Context
| |||||||||||
From interface
android.content.ComponentCallbacks2
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Return the communication channel to the service.
| |||||||||||
Override this method to download MMSs received.
| |||||||||||
Override this method to filter inbound SMS messages.
| |||||||||||
Override this method to intercept binary SMSs sent from the device.
| |||||||||||
This method was deprecated
in API level 23.
Override
onSendDataSms(byte[], int, String, int, CarrierMessagingService.ResultCallback below instead.
| |||||||||||
Override this method to intercept MMSs sent from the device.
| |||||||||||
Override this method to intercept long SMSs sent from the device.
| |||||||||||
This method was deprecated
in API level 23.
Override
onSendMultipartTextSms(List below instead.
| |||||||||||
This method was deprecated
in API level 23.
Override
onSendTextSms(String, int, String, CarrierMessagingService.ResultCallback below instead.
| |||||||||||
Override this method to intercept text SMSs sent from the device.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.app.Service
| |||||||||||
From class
android.content.ContextWrapper
| |||||||||||
From class
android.content.Context
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
android.content.ComponentCallbacks2
| |||||||||||
From interface
android.content.ComponentCallbacks
|
MMS downloading failed. We should not retry via the carrier network.
Successfully downloaded an MMS message.
MMS downloading failed. We should retry via the carrier network.
Flag to request SMS delivery status report.
SMS/MMS sending failed. We should not retry via the carrier network.
Indicates that an SMS or MMS message was successfully sent.
SMS/MMS sending failed. We should retry via the carrier network.
The Intent
that must be declared as handled by the service.
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.
intent | The Intent that was used to bind to this service,
as given to Context.bindService . Note that any extras that were included with
the Intent at that point will not be seen here. |
---|
Override this method to download MMSs received.
contentUri | the content provider URI of the PDU to be downloaded. |
---|---|
subId | SMS subscription ID of the SIM |
location | the URI of the message to be downloaded. |
callback | result callback. Call with a status code which is one of
DOWNLOAD_STATUS_OK ,
DOWNLOAD_STATUS_RETRY_ON_CARRIER_NETWORK , or DOWNLOAD_STATUS_ERROR .
|
Override this method to filter inbound SMS messages.
pdu | the PDUs of the message |
---|---|
format | the format of the PDUs, typically "3gpp" or "3gpp2" |
destPort | the destination port of a binary SMS, this will be -1 for text SMS |
subId | SMS subscription ID of the SIM |
callback | result callback. Call with true to keep an inbound SMS message and
deliver to SMS apps, and false to drop the message.
|
Override this method to intercept binary SMSs sent from the device.
data | the binary content |
---|---|
subId | SMS subscription ID of the SIM |
destAddress | phone number of the recipient of the message |
destPort | the destination port |
sendSmsFlag | Flag for sending SMS. Acceptable values are 0 and
SEND_FLAG_REQUEST_DELIVERY_STATUS . |
callback | result callback. Call with a CarrierMessagingService.SendSmsResult .
|
This method was deprecated
in API level 23.
Override onSendDataSms(byte[], int, String, int, CarrierMessagingService.ResultCallback
below instead.
Override this method to intercept binary SMSs sent from the device.
data | the binary content |
---|---|
subId | SMS subscription ID of the SIM |
destAddress | phone number of the recipient of the message |
destPort | the destination port |
callback | result callback. Call with a CarrierMessagingService.SendSmsResult .
|
Override this method to intercept MMSs sent from the device.
pduUri | the content provider URI of the PDU to send |
---|---|
subId | SMS subscription ID of the SIM |
location | the optional URI to send this MMS PDU. If this is {code null}, the PDU should be sent to the default MMSC URL. |
callback | result callback. Call with a CarrierMessagingService.SendMmsResult .
|
Override this method to intercept long SMSs sent from the device.
parts | a List of the message parts |
---|---|
subId | SMS subscription ID of the SIM |
destAddress | phone number of the recipient of the message |
sendSmsFlag | Flag for sending SMS. Acceptable values are 0 and
SEND_FLAG_REQUEST_DELIVERY_STATUS . |
callback | result callback. Call with a CarrierMessagingService.SendMultipartSmsResult .
|
This method was deprecated
in API level 23.
Override onSendMultipartTextSms(List
below instead.
Override this method to intercept long SMSs sent from the device.
parts | a List of the message parts |
---|---|
subId | SMS subscription ID of the SIM |
destAddress | phone number of the recipient of the message |
callback | result callback. Call with a CarrierMessagingService.SendMultipartSmsResult .
|
This method was deprecated
in API level 23.
Override onSendTextSms(String, int, String, CarrierMessagingService.ResultCallback
below instead.
Override this method to intercept text SMSs sent from the device.
text | the text to send |
---|---|
subId | SMS subscription ID of the SIM |
destAddress | phone number of the recipient of the message |
callback | result callback. Call with a CarrierMessagingService.SendSmsResult .
|
Override this method to intercept text SMSs sent from the device.
text | the text to send |
---|---|
subId | SMS subscription ID of the SIM |
destAddress | phone number of the recipient of the message |
sendSmsFlag | Flag for sending SMS. Acceptable values are 0 and
SEND_FLAG_REQUEST_DELIVERY_STATUS . |
callback | result callback. Call with a CarrierMessagingService.SendSmsResult .
|