AlternativeMessageTransportService


public abstract class AlternativeMessageTransportService
extends Service

java.lang.Object
   ↳ android.content.Context
     ↳ android.content.ContextWrapper
       ↳ android.app.Service
         ↳ android.service.messaging.AlternativeMessageTransportService


AlternativeMessageTransportService (AMTS) allows the default SMS app to handle the sending of a message over a different transport (e.g. RCS etc.) other than the SMS or MMS. When an SMS or MMS is being sent, the Telephony framework checks if the default SMS app has implemented this service. If so, it binds to the service and requests the SMS app to send it over it's preferred transport.

If the service accepts the upgrade request, the default SMS app is solely responsible for sending the message to the recipient and moving it from the OUTBOX to SENT or FAILED folder.

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

<service android:name=".MyAlternativeMessageTransportService"
         android:permission="android.permission.BIND_ALTERNATIVE_MESSAGE_TRANSPORT_SERVICE"
         android:exported="true">
    <intent-filter>
        <action android:name="android.service.messaging.AlternativeMessageTransportService"
        />
    </intent-filter>
</service>

Summary

Constants

String SERVICE_INTERFACE

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

int UPGRADE_STATUS_ACCEPTED

Status code when the default SMS app has accepted the message upgrade request and will now attempt to send it as per it's supported transport.

int UPGRADE_STATUS_REJECTED

Status code when the default SMS app could not accept the message upgrade request.

Inherited constants

Public constructors

AlternativeMessageTransportService()

Public methods

final IBinder onBind(Intent intent)

Return the communication channel to the service.

abstract void onMessageUpgradeRequested(Uri contentUri, Consumer<Integer> upgradeStatus)

Called by the service upon receiving a new message upgrade request.

Inherited methods