ImsRcsManager

public class ImsRcsManager
extends Object

java.lang.Object
   ↳ android.telephony.ims.ImsRcsManager


Manager for interfacing with the framework RCS services, including the User Capability Exchange (UCE) service, as well as managing user settings. Use ImsManager.getImsRcsManager(int) to create an instance of this manager.
Requires the PackageManager#FEATURE_TELEPHONY_IMS feature which can be detected using PackageManager.hasSystemFeature(String).

Summary

Constants

String ACTION_SHOW_CAPABILITY_DISCOVERY_OPT_IN

Activity Action: Show the opt-in dialog for enabling or disabling RCS contact discovery using User Capability Exchange (UCE), which enables a service that periodically shares the phone numbers of all of the contacts in the user's address book with the carrier to refresh the RCS capabilities associated with those contacts as the local cache becomes stale.

int CAPABILITY_TYPE_NONE

Undefined capability type for initialization

int CAPABILITY_TYPE_OPTIONS_UCE

This carrier supports User Capability Exchange using SIP OPTIONS as defined by the framework.

int CAPABILITY_TYPE_PRESENCE_UCE

This carrier supports User Capability Exchange using a presence server as defined by the framework.

Public methods

void getRegistrationState(Executor executor, Consumer<Integer> stateCallback)

Gets the registration state of the IMS service.

void getRegistrationTransportType(Executor executor, Consumer<Integer> transportTypeCallback)

Gets the Transport Type associated with the current IMS registration.

RcsUceAdapter getUceAdapter()
void registerImsRegistrationCallback(Executor executor, RegistrationManager.RegistrationCallback c)

Registers a RegistrationManager.RegistrationCallback with the system.

void registerImsStateCallback(Executor executor, ImsStateCallback callback)

Register a new callback, which is used to notify the registrant of changes to the state of the underlying IMS service that is attached to telephony to implement IMS functionality.

void unregisterImsRegistrationCallback(RegistrationManager.RegistrationCallback c)

Removes an existing RegistrationManager.RegistrationCallback.

void unregisterImsStateCallback(ImsStateCallback callback)

Unregisters a previously registered callback.

Inherited methods

Constants

ACTION_SHOW_CAPABILITY_DISCOVERY_OPT_IN

Added in API level 30
public static final String ACTION_SHOW_CAPABILITY_DISCOVERY_OPT_IN

Activity Action: Show the opt-in dialog for enabling or disabling RCS contact discovery using User Capability Exchange (UCE), which enables a service that periodically shares the phone numbers of all of the contacts in the user's address book with the carrier to refresh the RCS capabilities associated with those contacts as the local cache becomes stale.

An application that depends on RCS contact discovery being enabled must send this intent using Context#startActivity(Intent) to ask the user to opt-in for contacts upload for capability exchange if it is currently disabled. Whether or not RCS contact discovery has been enabled by the user can be queried using RcsUceAdapter#isUceSettingEnabled().

This intent will always be handled by the system, however the application should only send this Intent if the carrier supports bulk RCS contact exchange, which will be true if either key CarrierConfigManager.Ims.KEY_RCS_BULK_CAPABILITY_EXCHANGE_BOOL or CarrierConfigManager.KEY_USE_RCS_PRESENCE_BOOL is set to true. Otherwise, the RCS contact discovery opt-in dialog will not be shown.

Input: A mandatory Settings#EXTRA_SUB_ID extra containing the subscription that the setting will be be shown for.

Output: Nothing

See also:

Constant Value: "android.telephony.ims.action.SHOW_CAPABILITY_DISCOVERY_OPT_IN"

CAPABILITY_TYPE_NONE

Added in API level 33
public static final int CAPABILITY_TYPE_NONE

Undefined capability type for initialization

Constant Value: 0 (0x00000000)

CAPABILITY_TYPE_OPTIONS_UCE

Added in API level 33
public static final int CAPABILITY_TYPE_OPTIONS_UCE

This carrier supports User Capability Exchange using SIP OPTIONS as defined by the framework. If set, the RcsFeature should support capability exchange using SIP OPTIONS. If not set, this RcsFeature should not service capability requests.

Constant Value: 1 (0x00000001)

CAPABILITY_TYPE_PRESENCE_UCE

Added in API level 33
public static final int CAPABILITY_TYPE_PRESENCE_UCE

This carrier supports User Capability Exchange using a presence server as defined by the framework. If set, the RcsFeature should support capability exchange using a presence server. If not set, this RcsFeature should not publish capabilities or service capability requests using presence.

Constant Value: 2 (0x00000002)

Public methods

getRegistrationState

Added in API level 31
public void getRegistrationState (Executor executor, 
                Consumer<Integer> stateCallback)

Gets the registration state of the IMS service. Requires Permission: READ_PRECISE_PHONE_STATE or that the calling app has carrier privileges (see TelephonyManager.hasCarrierPrivileges()).
Requires Manifest.permission.READ_PRECISE_PHONE_STATE

Parameters
executor Executor: The Executor that will be used to call the IMS registration state callback. This value cannot be null. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). Otherwise, provide an Executor that dispatches to an appropriate thread.

stateCallback Consumer: A callback called on the supplied Executor that will contain the registration state of the IMS service, which will be one of the following: RegistrationManager#REGISTRATION_STATE_NOT_REGISTERED, RegistrationManager#REGISTRATION_STATE_REGISTERING, or RegistrationManager#REGISTRATION_STATE_REGISTERED. This value cannot be null. Value is RegistrationManager.REGISTRATION_STATE_NOT_REGISTERED, RegistrationManager.REGISTRATION_STATE_REGISTERING, or RegistrationManager.REGISTRATION_STATE_REGISTERED

Throws
UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_IMS.

getRegistrationTransportType

Added in API level 31
public void getRegistrationTransportType (Executor executor, 
                Consumer<Integer> transportTypeCallback)

Gets the Transport Type associated with the current IMS registration. Requires Permission: READ_PRECISE_PHONE_STATE or that the calling app has carrier privileges (see TelephonyManager.hasCarrierPrivileges()).
Requires Manifest.permission.READ_PRECISE_PHONE_STATE

Parameters
executor Executor: The Executor that will be used to call the transportTypeCallback. This value cannot be null. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). Otherwise, provide an Executor that dispatches to an appropriate thread.

transportTypeCallback Consumer: The transport type associated with the current IMS registration, which will be one of following: , , or . This value cannot be null. Value is android.telephony.AccessNetworkConstants.TRANSPORT_TYPE_INVALID, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, or AccessNetworkConstants.TRANSPORT_TYPE_WLAN

Throws
UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_IMS.

getUceAdapter

Added in API level 30
public RcsUceAdapter getUceAdapter ()

Returns
RcsUceAdapter A RcsUceAdapter used for User Capability Exchange (UCE) operations for this subscription. This value cannot be null.

registerImsRegistrationCallback

Added in API level 31
public void registerImsRegistrationCallback (Executor executor, 
                RegistrationManager.RegistrationCallback c)

Registers a RegistrationManager.RegistrationCallback with the system. When the callback is registered, it will initiate the callback c to be called with the current registration state. Requires Permission: READ_PRECISE_PHONE_STATE or that the calling app has carrier privileges (see TelephonyManager.hasCarrierPrivileges()).
Requires Manifest.permission.READ_PRECISE_PHONE_STATE

Parameters
executor Executor: The executor the callback events should be run on. This value cannot be null. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). Otherwise, provide an Executor that dispatches to an appropriate thread.

c RegistrationManager.RegistrationCallback: The RegistrationManager.RegistrationCallback to be added. This value cannot be null.

Throws
ImsException if the subscription associated with this callback is valid, but the ImsService associated with the subscription is not available. This can happen if the service crashed, for example. See ImsException#getCode() for a more detailed reason.
UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_IMS.

registerImsStateCallback

Added in API level 33
public void registerImsStateCallback (Executor executor, 
                ImsStateCallback callback)

Register a new callback, which is used to notify the registrant of changes to the state of the underlying IMS service that is attached to telephony to implement IMS functionality. If the manager is created for the SubscriptionManager.DEFAULT_SUBSCRIPTION_ID, this throws an ImsException.

Requires Permission: READ_PRECISE_PHONE_STATE or that the calling app has carrier privileges (see TelephonyManager.hasCarrierPrivileges()).
Requires Manifest.permission.READ_PRECISE_PHONE_STATE or android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE or android.Manifest.permission.ACCESS_RCS_USER_CAPABILITY_EXCHANGE

Parameters
executor Executor: the Executor that will be used to call the ImsStateCallback. This value cannot be null.

callback ImsStateCallback: The callback instance being registered. This value cannot be null.

Throws
ImsException in the case that the callback can not be registered. See ImsException#getCode for more information on when this is called.

unregisterImsRegistrationCallback

Added in API level 31
public void unregisterImsRegistrationCallback (RegistrationManager.RegistrationCallback c)

Removes an existing RegistrationManager.RegistrationCallback. When the subscription associated with this callback is removed (SIM removed, ESIM swap, etc...), this callback will automatically be removed. If this method is called for an inactive subscription, it will result in a no-op. Requires Permission: READ_PRECISE_PHONE_STATE or that the calling app has carrier privileges (see TelephonyManager.hasCarrierPrivileges()).
Requires Manifest.permission.READ_PRECISE_PHONE_STATE

Parameters
c RegistrationManager.RegistrationCallback: The RegistrationManager.RegistrationCallback to be removed. This value cannot be null.

Throws
UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_IMS.

unregisterImsStateCallback

Added in API level 33
public void unregisterImsStateCallback (ImsStateCallback callback)

Unregisters a previously registered callback.

Parameters
callback ImsStateCallback: The callback instance to be unregistered. This value cannot be null.