CarrierMessagingServicepublic abstract class CarrierMessagingService extends android.app.Service 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 {@link android.Manifest.permission#BIND_CARRIER_MESSAGING_SERVICE} permission
and include an intent filter with the {@link #SERVICE_INTERFACE} action. For example:
<service android:name=".MyMessagingService"
android:label="@string/service_name"
android:permission="android.permission.BIND_CARRIER_MESSAGING_SERVICE">
<intent-filter>
<action android:name="android.service.carrier.CarrierMessagingService" />
</intent-filter>
</service> |
Fields Summary |
---|
public static final String | SERVICE_INTERFACEThe {@link android.content.Intent} that must be declared as handled by the service. | public static final int | SEND_STATUS_OKIndicates that an SMS or MMS message was successfully sent. | public static final int | SEND_STATUS_RETRY_ON_CARRIER_NETWORKSMS/MMS sending failed. We should retry via the carrier network. | public static final int | SEND_STATUS_ERRORSMS/MMS sending failed. We should not retry via the carrier network. | public static final int | DOWNLOAD_STATUS_OKSuccessfully downloaded an MMS message. | public static final int | DOWNLOAD_STATUS_RETRY_ON_CARRIER_NETWORKMMS downloading failed. We should retry via the carrier network. | public static final int | DOWNLOAD_STATUS_ERRORMMS downloading failed. We should not retry via the carrier network. | private final ICarrierMessagingWrapper | mWrapper |
Methods Summary |
---|
public android.os.IBinder | onBind(android.content.Intent intent)
if (!SERVICE_INTERFACE.equals(intent.getAction())) {
return null;
}
return mWrapper;
| public void | onDownloadMms(android.net.Uri contentUri, int subId, android.net.Uri location, android.service.carrier.CarrierMessagingService$ResultCallback callback)Override this method to download MMSs received.
// optional
try {
callback.onReceiveResult(DOWNLOAD_STATUS_RETRY_ON_CARRIER_NETWORK);
} catch (RemoteException ex) {
}
| public void | onFilterSms(MessagePdu pdu, java.lang.String format, int destPort, int subId, android.service.carrier.CarrierMessagingService$ResultCallback callback)Override this method to filter inbound SMS messages.
// optional
try {
callback.onReceiveResult(true);
} catch (RemoteException ex) {
}
| public void | onSendDataSms(byte[] data, int subId, java.lang.String destAddress, int destPort, android.service.carrier.CarrierMessagingService$ResultCallback callback)Override this method to intercept binary SMSs sent from the device.
// optional
try {
callback.onReceiveResult(new SendSmsResult(SEND_STATUS_RETRY_ON_CARRIER_NETWORK, 0));
} catch (RemoteException ex) {
}
| public void | onSendMms(android.net.Uri pduUri, int subId, android.net.Uri location, android.service.carrier.CarrierMessagingService$ResultCallback callback)Override this method to intercept MMSs sent from the device.
// optional
try {
callback.onReceiveResult(new SendMmsResult(SEND_STATUS_RETRY_ON_CARRIER_NETWORK, null));
} catch (RemoteException ex) {
}
| public void | onSendMultipartTextSms(java.util.List parts, int subId, java.lang.String destAddress, android.service.carrier.CarrierMessagingService$ResultCallback callback)Override this method to intercept long SMSs sent from the device.
// optional
try {
callback.onReceiveResult(
new SendMultipartSmsResult(SEND_STATUS_RETRY_ON_CARRIER_NETWORK, null));
} catch (RemoteException ex) {
}
| public void | onSendTextSms(java.lang.String text, int subId, java.lang.String destAddress, android.service.carrier.CarrierMessagingService$ResultCallback callback)Override this method to intercept text SMSs sent from the device.
// optional
try {
callback.onReceiveResult(new SendSmsResult(SEND_STATUS_RETRY_ON_CARRIER_NETWORK, 0));
} catch (RemoteException ex) {
}
|
|