public abstract class CarrierMessagingService extends Service
To extend this class, you must declare the service in your manifest file with
the android.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>
Modifier and Type | Class and Description |
---|---|
static interface |
CarrierMessagingService.ResultCallback<T>
A callback interface used to provide results asynchronously.
|
static class |
CarrierMessagingService.SendMmsResult
The result of sending an MMS.
|
static class |
CarrierMessagingService.SendMultipartSmsResult
The result of sending a multipart SMS.
|
static class |
CarrierMessagingService.SendSmsResult
The result of sending an SMS.
|
Service.StartArgFlags, Service.StartResult, Service.StopForegroundFlags
Context.BindServiceFlags, Context.CreatePackageOptions, Context.ServiceName
Modifier and Type | Field and Description |
---|---|
static int |
DOWNLOAD_STATUS_ERROR
MMS downloading failed.
|
static int |
DOWNLOAD_STATUS_OK
Successfully downloaded an MMS message.
|
static int |
DOWNLOAD_STATUS_RETRY_ON_CARRIER_NETWORK
MMS downloading failed.
|
static int |
RECEIVE_OPTIONS_DEFAULT
The default bitmask value passed to the callback of
onReceiveTextSms(android.service.carrier.MessagePdu, java.lang.String, int, int, android.service.carrier.CarrierMessagingService.ResultCallback<java.lang.Integer>) with all
RECEIVE_OPTIONS_x flags cleared to indicate that the message should be kept and a
new message notification should be shown. |
static int |
RECEIVE_OPTIONS_DROP
Used to set the flag in the bitmask passed to the callback of
onReceiveTextSms(android.service.carrier.MessagePdu, java.lang.String, int, int, android.service.carrier.CarrierMessagingService.ResultCallback<java.lang.Integer>) to
indicate that the inbound SMS should be dropped. |
static int |
RECEIVE_OPTIONS_SKIP_NOTIFY_WHEN_CREDENTIAL_PROTECTED_STORAGE_UNAVAILABLE
Used to set the flag in the bitmask passed to the callback of
onReceiveTextSms(android.service.carrier.MessagePdu, java.lang.String, int, int, android.service.carrier.CarrierMessagingService.ResultCallback<java.lang.Integer>) 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. |
static int |
SEND_FLAG_REQUEST_DELIVERY_STATUS
Flag to request SMS delivery status report.
|
static int |
SEND_STATUS_ERROR
SMS/MMS sending failed.
|
static int |
SEND_STATUS_OK
Indicates that an SMS or MMS message was successfully sent.
|
static int |
SEND_STATUS_RETRY_ON_CARRIER_NETWORK
SMS/MMS sending failed.
|
static String |
SERVICE_INTERFACE
The
Intent that must be declared as handled by the service. |
START_CONTINUATION_MASK, START_FLAG_REDELIVERY, START_FLAG_RETRY, START_NOT_STICKY, START_REDELIVER_INTENT, START_STICKY, START_STICKY_COMPATIBILITY, START_TASK_REMOVED_COMPLETE, STOP_FOREGROUND_DETACH, STOP_FOREGROUND_REMOVE
ACCESSIBILITY_SERVICE, ACCOUNT_SERVICE, ACTIVITY_SERVICE, ALARM_SERVICE, APP_OPS_SERVICE, APPWIDGET_SERVICE, AUDIO_SERVICE, BACKUP_SERVICE, BATTERY_SERVICE, BIND_ABOVE_CLIENT, BIND_ADJUST_WITH_ACTIVITY, BIND_ALLOW_OOM_MANAGEMENT, BIND_ALLOW_WHITELIST_MANAGEMENT, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, BIND_EXTERNAL_SERVICE, BIND_FOREGROUND_SERVICE, BIND_FOREGROUND_SERVICE_WHILE_AWAKE, BIND_IMPORTANT, BIND_NOT_FOREGROUND, BIND_NOT_VISIBLE, BIND_SHOWING_UI, BIND_TREAT_LIKE_ACTIVITY, BIND_VISIBLE, BIND_WAIVE_PRIORITY, BLUETOOTH_SERVICE, CAMERA_SERVICE, CAPTIONING_SERVICE, CARRIER_CONFIG_SERVICE, CLIPBOARD_SERVICE, CONNECTIVITY_SERVICE, CONSUMER_IR_SERVICE, CONTEXT_CREDENTIAL_PROTECTED_STORAGE, CONTEXT_DEVICE_PROTECTED_STORAGE, CONTEXT_IGNORE_SECURITY, CONTEXT_INCLUDE_CODE, CONTEXT_REGISTER_PACKAGE, CONTEXT_RESTRICTED, CONTEXTHUB_SERVICE, COUNTRY_DETECTOR, DEVICE_IDLE_CONTROLLER, DEVICE_POLICY_SERVICE, DISPLAY_SERVICE, DOWNLOAD_SERVICE, DROPBOX_SERVICE, ETHERNET_SERVICE, FINGERPRINT_SERVICE, GATEKEEPER_SERVICE, HARDWARE_PROPERTIES_SERVICE, HDMI_CONTROL_SERVICE, INPUT_METHOD_SERVICE, INPUT_SERVICE, JOB_SCHEDULER_SERVICE, KEYGUARD_SERVICE, LAUNCHER_APPS_SERVICE, LAYOUT_INFLATER_SERVICE, LOCATION_SERVICE, MEDIA_PROJECTION_SERVICE, MEDIA_ROUTER_SERVICE, MEDIA_SESSION_SERVICE, MIDI_SERVICE, MODE_APPEND, MODE_ENABLE_WRITE_AHEAD_LOGGING, MODE_MULTI_PROCESS, MODE_NO_LOCALIZED_COLLATORS, MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE, NETWORK_POLICY_SERVICE, NETWORK_SCORE_SERVICE, NETWORK_STATS_SERVICE, NETWORKMANAGEMENT_SERVICE, NFC_SERVICE, NOTIFICATION_SERVICE, NSD_SERVICE, PERSISTENT_DATA_BLOCK_SERVICE, POWER_SERVICE, PRINT_SERVICE, RADIO_SERVICE, RECOVERY_SERVICE, RESTRICTIONS_SERVICE, SEARCH_SERVICE, SENSOR_SERVICE, SERIAL_SERVICE, SHORTCUT_SERVICE, SIP_SERVICE, SOUND_TRIGGER_SERVICE, STATUS_BAR_SERVICE, STORAGE_SERVICE, SYSTEM_HEALTH_SERVICE, TELECOM_SERVICE, TELEPHONY_SERVICE, TELEPHONY_SUBSCRIPTION_SERVICE, TEXT_SERVICES_MANAGER_SERVICE, TRUST_SERVICE, TV_INPUT_SERVICE, UI_MODE_SERVICE, UPDATE_LOCK_SERVICE, USAGE_STATS_SERVICE, USB_SERVICE, USER_SERVICE, VIBRATOR_SERVICE, VOICE_INTERACTION_MANAGER_SERVICE, WALLPAPER_SERVICE, WIFI_NAN_SERVICE, WIFI_P2P_SERVICE, WIFI_RTT_SERVICE, WIFI_SCANNING_SERVICE, WIFI_SERVICE, WINDOW_SERVICE
TRIM_MEMORY_BACKGROUND, TRIM_MEMORY_COMPLETE, TRIM_MEMORY_MODERATE, TRIM_MEMORY_RUNNING_CRITICAL, TRIM_MEMORY_RUNNING_LOW, TRIM_MEMORY_RUNNING_MODERATE, TRIM_MEMORY_UI_HIDDEN
Constructor and Description |
---|
CarrierMessagingService() |
Modifier and Type | Method and Description |
---|---|
IBinder |
onBind(Intent intent)
Return the communication channel to the service.
|
void |
onDownloadMms(Uri contentUri,
int subId,
Uri location,
CarrierMessagingService.ResultCallback<Integer> callback)
Override this method to download MMSs received.
|
void |
onFilterSms(MessagePdu pdu,
String format,
int destPort,
int subId,
CarrierMessagingService.ResultCallback<Boolean> callback)
|
void |
onReceiveTextSms(MessagePdu pdu,
String format,
int destPort,
int subId,
CarrierMessagingService.ResultCallback<Integer> callback)
Override this method to filter inbound SMS messages.
|
void |
onSendDataSms(byte[] data,
int subId,
String destAddress,
int destPort,
CarrierMessagingService.ResultCallback<CarrierMessagingService.SendSmsResult> callback)
|
void |
onSendDataSms(byte[] data,
int subId,
String destAddress,
int destPort,
int sendSmsFlag,
CarrierMessagingService.ResultCallback<CarrierMessagingService.SendSmsResult> callback)
Override this method to intercept binary SMSs sent from the device.
|
void |
onSendMms(Uri pduUri,
int subId,
Uri location,
CarrierMessagingService.ResultCallback<CarrierMessagingService.SendMmsResult> callback)
Override this method to intercept MMSs sent from the device.
|
void |
onSendMultipartTextSms(List<String> parts,
int subId,
String destAddress,
CarrierMessagingService.ResultCallback<CarrierMessagingService.SendMultipartSmsResult> callback)
|
void |
onSendMultipartTextSms(List<String> parts,
int subId,
String destAddress,
int sendSmsFlag,
CarrierMessagingService.ResultCallback<CarrierMessagingService.SendMultipartSmsResult> callback)
Override this method to intercept long SMSs sent from the device.
|
void |
onSendTextSms(String text,
int subId,
String destAddress,
CarrierMessagingService.ResultCallback<CarrierMessagingService.SendSmsResult> callback)
|
void |
onSendTextSms(String text,
int subId,
String destAddress,
int sendSmsFlag,
CarrierMessagingService.ResultCallback<CarrierMessagingService.SendSmsResult> callback)
Override this method to intercept text SMSs sent from the device.
|
attach, dump, getApplication, onConfigurationChanged, onCreate, onDestroy, onLowMemory, onRebind, onStart, onStartCommand, onTaskRemoved, onTrimMemory, onUnbind, setForeground, startForeground, stopForeground, stopForeground, stopSelf, stopSelf, stopSelfResult
attachBaseContext, bindService, bindServiceAsUser, canStartActivityForResult, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingPermission, checkCallingUriPermission, checkPermission, checkPermission, checkSelfPermission, checkUriPermission, checkUriPermission, checkUriPermission, clearWallpaper, createApplicationContext, createConfigurationContext, createCredentialProtectedStorageContext, createDeviceProtectedStorageContext, createDisplayContext, createPackageContext, createPackageContextAsUser, databaseList, deleteDatabase, deleteFile, deleteSharedPreferences, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getAssets, getBaseContext, getBasePackageName, getCacheDir, getClassLoader, getCodeCacheDir, getContentResolver, getDatabasePath, getDataDir, getDir, getDisplay, getDisplayAdjustments, getExternalCacheDir, getExternalCacheDirs, getExternalFilesDir, getExternalFilesDirs, getExternalMediaDirs, getFilesDir, getFileStreamPath, getMainLooper, getNoBackupFilesDir, getObbDir, getObbDirs, getOpPackageName, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getResources, getSharedPreferences, getSharedPreferences, getSharedPreferencesPath, getSystemService, getSystemServiceName, getTheme, getThemeResId, getUserId, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, isCredentialProtectedStorage, isDeviceProtectedStorage, isRestricted, moveDatabaseFrom, moveSharedPreferencesFrom, openFileInput, openFileOutput, openOrCreateDatabase, openOrCreateDatabase, peekWallpaper, registerReceiver, registerReceiver, registerReceiverAsUser, removeStickyBroadcast, removeStickyBroadcastAsUser, revokeUriPermission, sendBroadcast, sendBroadcast, sendBroadcast, sendBroadcast, sendBroadcastAsUser, sendBroadcastAsUser, sendBroadcastAsUser, sendBroadcastMultiplePermissions, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcastAsUser, sendOrderedBroadcastAsUser, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyBroadcastAsUser, sendStickyBroadcastAsUser, sendStickyOrderedBroadcast, sendStickyOrderedBroadcastAsUser, setTheme, setWallpaper, setWallpaper, startActivities, startActivities, startActivitiesAsUser, startActivity, startActivity, startActivityAsUser, startActivityAsUser, startActivityForResult, startInstrumentation, startIntentSender, startIntentSender, startService, startServiceAsUser, stopService, stopServiceAsUser, unbindService, unregisterReceiver
bindServiceAsUser, createCredentialEncryptedStorageContext, createDeviceEncryptedStorageContext, getColor, getColorStateList, getDrawable, getSharedPrefsFile, getString, getString, getSystemService, getText, isCredentialEncryptedStorage, isDeviceEncryptedStorage, migrateDatabaseFrom, migrateSharedPreferencesFrom, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, registerComponentCallbacks, unregisterComponentCallbacks
public static final String SERVICE_INTERFACE
Intent
that must be declared as handled by the service.public static final int RECEIVE_OPTIONS_DEFAULT
onReceiveTextSms(android.service.carrier.MessagePdu, java.lang.String, int, int, android.service.carrier.CarrierMessagingService.ResultCallback<java.lang.Integer>)
with all
RECEIVE_OPTIONS_x
flags cleared to indicate that the message should be kept and a
new message notification should be shown.public static final int RECEIVE_OPTIONS_DROP
onReceiveTextSms(android.service.carrier.MessagePdu, java.lang.String, int, int, android.service.carrier.CarrierMessagingService.ResultCallback<java.lang.Integer>)
to
indicate that the inbound SMS should be dropped.public static final int RECEIVE_OPTIONS_SKIP_NOTIFY_WHEN_CREDENTIAL_PROTECTED_STORAGE_UNAVAILABLE
onReceiveTextSms(android.service.carrier.MessagePdu, java.lang.String, int, int, android.service.carrier.CarrierMessagingService.ResultCallback<java.lang.Integer>)
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.public static final int SEND_STATUS_OK
public static final int SEND_STATUS_RETRY_ON_CARRIER_NETWORK
public static final int SEND_STATUS_ERROR
public static final int DOWNLOAD_STATUS_OK
public static final int DOWNLOAD_STATUS_RETRY_ON_CARRIER_NETWORK
public static final int DOWNLOAD_STATUS_ERROR
public static final int SEND_FLAG_REQUEST_DELIVERY_STATUS
@Deprecated public void onFilterSms(MessagePdu pdu, String format, int destPort, int subId, CarrierMessagingService.ResultCallback<Boolean> callback)
onReceiveTextSms(android.service.carrier.MessagePdu, java.lang.String, int, int, android.service.carrier.CarrierMessagingService.ResultCallback<java.lang.Integer>)
instead.pdu
- the PDUs of the messageformat
- the format of the PDUs, typically "3gpp" or "3gpp2"destPort
- the destination port of a binary SMS, this will be -1 for text SMSsubId
- SMS subscription ID of the SIMcallback
- result callback. Call with true
to keep an inbound SMS message and
deliver to SMS apps, and false
to drop the message.public void onReceiveTextSms(MessagePdu pdu, String format, int destPort, int subId, CarrierMessagingService.ResultCallback<Integer> callback)
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.
pdu
- the PDUs of the messageformat
- the format of the PDUs, typically "3gpp" or "3gpp2"destPort
- the destination port of a binary SMS, this will be -1 for text SMSsubId
- SMS subscription ID of the SIMcallback
- 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.@Deprecated public void onSendTextSms(String text, int subId, String destAddress, CarrierMessagingService.ResultCallback<CarrierMessagingService.SendSmsResult> callback)
onSendTextSms(java.lang.String, int, java.lang.String, android.service.carrier.CarrierMessagingService.ResultCallback<android.service.carrier.CarrierMessagingService.SendSmsResult>)
below instead.text
- the text to sendsubId
- SMS subscription ID of the SIMdestAddress
- phone number of the recipient of the messagecallback
- result callback. Call with a CarrierMessagingService.SendSmsResult
.public void onSendTextSms(String text, int subId, String destAddress, int sendSmsFlag, CarrierMessagingService.ResultCallback<CarrierMessagingService.SendSmsResult> callback)
text
- the text to sendsubId
- SMS subscription ID of the SIMdestAddress
- phone number of the recipient of the messagesendSmsFlag
- Flag for sending SMS. Acceptable values are 0 and
SEND_FLAG_REQUEST_DELIVERY_STATUS
.callback
- result callback. Call with a CarrierMessagingService.SendSmsResult
.@Deprecated public void onSendDataSms(byte[] data, int subId, String destAddress, int destPort, CarrierMessagingService.ResultCallback<CarrierMessagingService.SendSmsResult> callback)
onSendDataSms(byte[], int, java.lang.String, int, android.service.carrier.CarrierMessagingService.ResultCallback<android.service.carrier.CarrierMessagingService.SendSmsResult>)
below instead.data
- the binary contentsubId
- SMS subscription ID of the SIMdestAddress
- phone number of the recipient of the messagedestPort
- the destination portcallback
- result callback. Call with a CarrierMessagingService.SendSmsResult
.public void onSendDataSms(byte[] data, int subId, String destAddress, int destPort, int sendSmsFlag, CarrierMessagingService.ResultCallback<CarrierMessagingService.SendSmsResult> callback)
data
- the binary contentsubId
- SMS subscription ID of the SIMdestAddress
- phone number of the recipient of the messagedestPort
- the destination portsendSmsFlag
- Flag for sending SMS. Acceptable values are 0 and
SEND_FLAG_REQUEST_DELIVERY_STATUS
.callback
- result callback. Call with a CarrierMessagingService.SendSmsResult
.@Deprecated public void onSendMultipartTextSms(List<String> parts, int subId, String destAddress, CarrierMessagingService.ResultCallback<CarrierMessagingService.SendMultipartSmsResult> callback)
onSendMultipartTextSms(java.util.List<java.lang.String>, int, java.lang.String, android.service.carrier.CarrierMessagingService.ResultCallback<android.service.carrier.CarrierMessagingService.SendMultipartSmsResult>)
below instead.parts
- a List
of the message partssubId
- SMS subscription ID of the SIMdestAddress
- phone number of the recipient of the messagecallback
- result callback. Call with a CarrierMessagingService.SendMultipartSmsResult
.public void onSendMultipartTextSms(List<String> parts, int subId, String destAddress, int sendSmsFlag, CarrierMessagingService.ResultCallback<CarrierMessagingService.SendMultipartSmsResult> callback)
parts
- a List
of the message partssubId
- SMS subscription ID of the SIMdestAddress
- phone number of the recipient of the messagesendSmsFlag
- Flag for sending SMS. Acceptable values are 0 and
SEND_FLAG_REQUEST_DELIVERY_STATUS
.callback
- result callback. Call with a CarrierMessagingService.SendMultipartSmsResult
.public void onSendMms(Uri pduUri, int subId, Uri location, CarrierMessagingService.ResultCallback<CarrierMessagingService.SendMmsResult> callback)
pduUri
- the content provider URI of the PDU to sendsubId
- SMS subscription ID of the SIMlocation
- 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
.public void onDownloadMms(Uri contentUri, int subId, Uri location, CarrierMessagingService.ResultCallback<Integer> callback)
contentUri
- the content provider URI of the PDU to be downloaded.subId
- SMS subscription ID of the SIMlocation
- 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
.public IBinder onBind(Intent intent)
Service
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.
onBind
in class Service
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.