# CallsManager

Artifact: [androidx.core:core-telecom](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/telecom/CallsManager.kt+class:androidx.core.telecom.CallsManager) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core#1.0.0)

*** ** * ** ***


```
@RequiresApi(value = 26)
class CallsManager : CallsManagerExtensions
```

<br />

*** ** * ** ***

CallsManager allows VoIP applications to add their calls to the Android system service Telecom. By doing this, other services are aware of your VoIP application calls which leads to a more stable environment. For example, a wearable may be able to answer an incoming call from your application if the call is added to the Telecom system. VoIP applications that manage calls and do not inform the Telecom system may experience issues with resources (ex. microphone access).

Note that access to some telecom information is permission-protected. Your app cannot access the protected information or gain access to protected functionality unless it has the appropriate permissions declared in its manifest file. Where permissions apply, they are noted in the method descriptions.

## Summary

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/telecom/CallsManager#CAPABILITY_BASELINE()` If your VoIP application does not want support any of the capabilities below, then your application can register with `https://developer.android.com/reference/kotlin/androidx/core/telecom/CallsManager#CAPABILITY_BASELINE()`. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/telecom/CallsManager#CAPABILITY_OPT_OUT_OF_PREMIUM_NETWORK()` Flag indicating that this VoIP application opts out of automatic requests for premium network capabilities. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/telecom/CallsManager#CAPABILITY_SUPPORTS_CALL_STREAMING()` Flag indicating that this VoIP application supports call streaming. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/telecom/CallsManager#CAPABILITY_SUPPORTS_VIDEO_CALLING()` Flag indicating that your VoIP application supports video calling. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/core/telecom/CallsManager#CallsManager(android.content.Context)(context: https://developer.android.com/reference/android/content/Context.html)` |

| ### Public functions |
|---|---|
| `suspend https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresPermission(value = "android.permission.MANAGE_OWN_CALLS") https://developer.android.com/reference/kotlin/androidx/core/telecom/CallsManager#addCall(androidx.core.telecom.CallAttributesCompat,kotlin.coroutines.SuspendFunction1,kotlin.coroutines.SuspendFunction1,kotlin.coroutines.SuspendFunction0,kotlin.coroutines.SuspendFunction0,kotlin.Function1)( callAttributes: https://developer.android.com/reference/kotlin/androidx/core/telecom/CallAttributesCompat, onAnswer: suspend (callType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html, onDisconnect: suspend (disconnectCause: https://developer.android.com/reference/android/telecom/DisconnectCause.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html, onSetActive: suspend () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html, onSetInactive: suspend () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html, block: https://developer.android.com/reference/kotlin/androidx/core/telecom/CallControlScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html )` Adds a new call with the specified `https://developer.android.com/reference/kotlin/androidx/core/telecom/CallAttributesCompat` to the telecom service. |
| `open suspend https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/telecom/CallsManager#addCallWithExtensions(androidx.core.telecom.CallAttributesCompat,kotlin.coroutines.SuspendFunction1,kotlin.coroutines.SuspendFunction1,kotlin.coroutines.SuspendFunction0,kotlin.coroutines.SuspendFunction0,kotlin.coroutines.SuspendFunction1)( callAttributes: https://developer.android.com/reference/kotlin/androidx/core/telecom/CallAttributesCompat, onAnswer: suspend (callType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html, onDisconnect: suspend (disconnectCause: https://developer.android.com/reference/android/telecom/DisconnectCause.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html, onSetActive: suspend () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html, onSetInactive: suspend () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html, init: suspend https://developer.android.com/reference/kotlin/androidx/core/telecom/extensions/ExtensionInitializationScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html )` Adds a call with extensions support, which allows an app to implement optional additional actions that go beyond the scope of a call, such as information about meeting participants and icons. |
| `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/core/telecom/CallEndpointCompat>>` | `https://developer.android.com/reference/kotlin/androidx/core/telecom/CallsManager#getAvailableStartingCallEndpoints()()` Continuously streams available call audio endpoints that can be used for a new call session. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresPermission(value = "android.permission.MANAGE_OWN_CALLS") https://developer.android.com/reference/kotlin/androidx/core/telecom/CallsManager#registerAppWithTelecom(kotlin.Int,kotlin.Int)(capabilities: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, backwardsCompatSdkLevel: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Registers the application with the Telecom framework. |

## Constants

### CAPABILITY_BASELINE

```
const val CAPABILITY_BASELINE: Int
```

If your VoIP application does not want support any of the capabilities below, then your application can register with `https://developer.android.com/reference/kotlin/androidx/core/telecom/CallsManager#CAPABILITY_BASELINE()`.

Note: Calls can still be added and to the Telecom system but if other services request to perform a capability that is not supported by your application, Telecom will notify the service of the inability to perform the action instead of hitting an error.

### CAPABILITY_OPT_OUT_OF_PREMIUM_NETWORK

```
const val CAPABILITY_OPT_OUT_OF_PREMIUM_NETWORK: Int
```

Flag indicating that this VoIP application opts out of automatic requests for premium network capabilities.

By default, the system may automatically request a premium network slice for voice and video calls to improve quality of service. Applications with their own sophisticated network management logic can use this flag to disable the system's behavior and manage network requests themselves.

This capability should be passed in {@link #registerAppWithTelecom(int, int)}.

### CAPABILITY_SUPPORTS_CALL_STREAMING

```
const val CAPABILITY_SUPPORTS_CALL_STREAMING: Int
```

Flag indicating that this VoIP application supports call streaming. Call streaming means a call can be streamed from a root device to another device to continue the call without completely transferring it. The call continues to take place on the source device, however media and control are streamed to another device. `https://developer.android.com/reference/kotlin/androidx/core/telecom/CallAttributesCompat.Companion.CallType`#`https://developer.android.com/reference/kotlin/androidx/core/telecom/CallsManager#CAPABILITY_SUPPORTS_CALL_STREAMING()` must also be set on per call basis in the event an application wants to gate this capability on a stricter basis.

### CAPABILITY_SUPPORTS_VIDEO_CALLING

```
const val CAPABILITY_SUPPORTS_VIDEO_CALLING: Int
```

Flag indicating that your VoIP application supports video calling. This is not an indication that your application is currently able to make a video call, but rather that it has the ability to make video calls (but not necessarily at this time).

Whether a call can make a video call is ultimately controlled by `https://developer.android.com/reference/kotlin/androidx/core/telecom/CallAttributesCompat`s capability `https://developer.android.com/reference/kotlin/androidx/core/telecom/CallAttributesCompat.Companion.CallType`#`https://developer.android.com/reference/kotlin/androidx/core/telecom/CallAttributesCompat#CALL_TYPE_VIDEO_CALL()`, which indicates that particular call is currently capable of making a video call.

## Public constructors

### CallsManager

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core#1.0.0)

```
CallsManager(context: Context)
```

## Public functions

### addCall

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core#1.0.0)

```
@RequiresPermission(value = "android.permission.MANAGE_OWN_CALLS")
suspend fun addCall(
    callAttributes: CallAttributesCompat,
    onAnswer: suspend (callType: Int) -> Unit,
    onDisconnect: suspend (disconnectCause: DisconnectCause) -> Unit,
    onSetActive: suspend () -> Unit,
    onSetInactive: suspend () -> Unit,
    block: CallControlScope.() -> Unit
): Unit
```

Adds a new call with the specified `https://developer.android.com/reference/kotlin/androidx/core/telecom/CallAttributesCompat` to the telecom service. This method can be used to add both incoming and outgoing calls. Once the call is ready to be disconnected, use the `https://developer.android.com/reference/kotlin/androidx/core/telecom/CallControlScope#disconnect(android.telecom.DisconnectCause)`.

**Call Lifecycle** : Your app is given foreground execution priority as long as you have an ongoing call and are posting a `https://developer.android.com/reference/android/app/Notification.CallStyle.html` notification within 5 seconds of adding the call via this method. When your application is given foreground execution priority, your app is treated as a foreground service. Foreground execution priority will prevent the `https://developer.android.com/reference/android/app/ActivityManager.html` from killing your application when it is placed the background. Foreground execution priority is removed from your app when all of your app's calls terminate or your app no longer posts a valid notification.

- Other things that should be noted:

  - For outgoing calls, your application should either immediately post a `https://developer.android.com/reference/android/app/Notification.CallStyle.html` notification or delay adding the call via this addCall method until the remote side is ready.

  - addCall will NOT complete until the call session has ended. Instead, the addCall block, which is called the `https://developer.android.com/reference/kotlin/androidx/core/telecom/CallControlScope`, will run once the call has been added. Do not put addCall in a function expecting it to return or add logic after the addCall request that is important for the call session.

  - Only one call setup can be in progress at a time. If `https://developer.android.com/reference/kotlin/androidx/core/telecom/CallsManager#addCall(androidx.core.telecom.CallAttributesCompat,kotlin.coroutines.SuspendFunction1,kotlin.coroutines.SuspendFunction1,kotlin.coroutines.SuspendFunction0,kotlin.coroutines.SuspendFunction0,kotlin.Function1)` is invoked while another call is currently being set up and registered with the system, it will immediately throw an `https://developer.android.com/reference/kotlin/androidx/core/telecom/CallException` with `https://developer.android.com/reference/kotlin/androidx/core/telecom/CallException#ERROR_CALL_NOT_PERMITTED_AT_PRESENT_TIME()`. Client applications must wait for the existing call setup to complete (i.e. until the `https://developer.android.com/reference/kotlin/androidx/core/telecom/CallControlScope` block begins executing) before initiating another call.

  - Each lambda function (onAnswer, onDisconnect, onSetActive, onSetInactive) will be invoked by Telecom whenever the system needs your VoIP application to change the call state. For example, if there is an ongoing VoIP call in your application and the system receives a sim call, Telecom will invoke onSetInactive to place your call on hold/inactive if the user answers the incoming sim call. These events may not occur during most calls but should still be implemented in the event Telecom needs to manipulate your applications call state.

  - Each lambda function (onAnswer, onDisconnect, onSetActive, onSetInactive) has a timeout of 5000 milliseconds. Failing to complete the suspend fun before the timeout will result in a failed transaction.

  - Telecom assumes each callback (onAnswer, onDisconnect, onSetActive, onSetInactive) is handled successfully on the client side. If the callback cannot be completed, an Exception should be thrown. Telecom will rethrow the Exception and tear down the call session.

| Parameters |
|---|---|
| `callAttributes: https://developer.android.com/reference/kotlin/androidx/core/telecom/CallAttributesCompat` | attributes of the new call (incoming or outgoing, address, etc. ) |
| `onAnswer: suspend (callType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | where callType is the audio/video state the call should be answered as. Telecom is informing your VoIP application to answer an incoming call and set it to active. Telecom is requesting this on behalf of an system service (e.g. Automotive service) or a device (e.g. Wearable). |
| `onDisconnect: suspend (disconnectCause: https://developer.android.com/reference/android/telecom/DisconnectCause.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | where disconnectCause represents the cause for disconnecting the call. Telecom is informing your VoIP application to disconnect the incoming call. Telecom is requesting this on behalf of an system service (e.g. Automotive service) or a device (e.g. Wearable). |
| `onSetActive: suspend () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | Telecom is informing your VoIP application to set the call active. Telecom is requesting this on behalf of an system service (e.g. Automotive service) or a device (e.g. Wearable). |
| `onSetInactive: suspend () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | Telecom is informing your VoIP application to set the call inactive. This is the same as holding a call for two endpoints but can be extended to setting a meeting inactive. Telecom is requesting this on behalf of an system service (e.g. Automotive service) or a device (e.g.Wearable). Note: Your app must stop using the microphone and playing incoming media when returning. |
| `block: https://developer.android.com/reference/kotlin/androidx/core/telecom/CallControlScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | DSL interface block that will run when the call is ready |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unsupported-operation-exception/index.html` | if the device is on an invalid build |
| `https://developer.android.com/reference/kotlin/androidx/core/telecom/CallException` | if the platform cannot add the call (e.g. reached max # of calls) or failed with an exception (e.g. call was already removed) |
| `https://developer.android.com/reference/kotlin/androidx/core/telecom/CallException` | with error code `https://developer.android.com/reference/kotlin/androidx/core/telecom/CallException#ERROR_OPERATION_TIMED_OUT()` if the call failed to be added within 5000 milliseconds |
| `https://developer.android.com/reference/kotlin/androidx/core/telecom/CallException` | with error code `https://developer.android.com/reference/kotlin/androidx/core/telecom/CallException#ERROR_CALL_NOT_PERMITTED_AT_PRESENT_TIME()` if another call setup is currently in progress. Client applications must wait for the existing call setup to complete before initiating another call. |

### addCallWithExtensions

```
open suspend fun addCallWithExtensions(
    callAttributes: CallAttributesCompat,
    onAnswer: suspend (callType: Int) -> Unit,
    onDisconnect: suspend (disconnectCause: DisconnectCause) -> Unit,
    onSetActive: suspend () -> Unit,
    onSetInactive: suspend () -> Unit,
    init: suspend ExtensionInitializationScope.() -> Unit
): Unit
```

Adds a call with extensions support, which allows an app to implement optional additional actions that go beyond the scope of a call, such as information about meeting participants and icons.

| Parameters |
|---|---|
| `callAttributes: https://developer.android.com/reference/kotlin/androidx/core/telecom/CallAttributesCompat` | attributes of the new call (incoming or outgoing, address, etc. ) |
| `onAnswer: suspend (callType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | where callType is the audio/video state the call should be answered as. Telecom is informing your VoIP application to answer an incoming call and set it to active. Telecom is requesting this on behalf of an system service (e.g. Automotive service) or a device (e.g. Wearable). |
| `onDisconnect: suspend (disconnectCause: https://developer.android.com/reference/android/telecom/DisconnectCause.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | where disconnectCause represents the cause for disconnecting the call. Telecom is informing your VoIP application to disconnect the incoming call. Telecom is requesting this on behalf of an system service (e.g. Automotive service) or a device (e.g. Wearable). |
| `onSetActive: suspend () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | Telecom is informing your VoIP application to set the call active. Telecom is requesting this on behalf of an system service (e.g. Automotive service) or a device (e.g. Wearable). |
| `onSetInactive: suspend () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | Telecom is informing your VoIP application to set the call inactive. This is the same as holding a call for two endpoints but can be extended to setting a meeting inactive. Telecom is requesting this on behalf of an system service (e.g. Automotive service) or a device (e.g.Wearable). Note: Your app must stop using the microphone and playing incoming media when returning. |
| `init: suspend https://developer.android.com/reference/kotlin/androidx/core/telecom/extensions/ExtensionInitializationScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | The scope used to first initialize Extensions that will be used when the call is first notified to the platform and UX surfaces. Once the call is set up, the user's implementation of `https://developer.android.com/reference/kotlin/androidx/core/telecom/extensions/ExtensionInitializationScope#onCall(kotlin.coroutines.SuspendFunction1)` will be called. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/telecom/CallException` | with error code `https://developer.android.com/reference/kotlin/androidx/core/telecom/CallException#ERROR_CALL_NOT_PERMITTED_AT_PRESENT_TIME()` if another call setup is currently in progress. Client applications must wait for the existing call setup to complete before initiating another call. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/telecom/extensions/CallsManagerExtensions#addCallWithExtensions(androidx.core.telecom.CallAttributesCompat,kotlin.coroutines.SuspendFunction1,kotlin.coroutines.SuspendFunction1,kotlin.coroutines.SuspendFunction0,kotlin.coroutines.SuspendFunction0,kotlin.coroutines.SuspendFunction1)` |   |

### getAvailableStartingCallEndpoints

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core#1.0.0)

```
fun getAvailableStartingCallEndpoints(): Flow<List<CallEndpointCompat>>
```

Continuously streams available call audio endpoints that can be used for a new call session. This API leverages `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/index.html` to emit updates as the available audio endpoints change.

**Bluetooth Permissions**:

- For API level 31 and above: The `https://developer.android.com/reference/android/Manifest.permission.html#BLUETOOTH_CONNECT` runtime permission is highly recommended.

- For API levels 28-30: The following runtime permissions are highly recommended:

  - `https://developer.android.com/reference/android/Manifest.permission.html#BLUETOOTH` - Allows apps to view Bluetooth information.

  - `https://developer.android.com/reference/android/Manifest.permission.html#BLUETOOTH_ADMIN` - Allows apps to connect to paired devices.

For all API levels: Granting these permissions allows the API to display the names of multiple connected Bluetooth devices. Without these permissions, only the active Bluetooth device will be surfaced.

**Coroutine Usage and Cleanup:** The returned `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html` from this `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/index.html` should be collected within a `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html`. To properly manage resources and prevent leaks, ensure that the `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html` is cancelled when it's no longer needed. This can be achieved by calling `cancel()` on the `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-job/index.html` of the collecting `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html`. Ideally, this cleanup should occur within the same scope where the `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html` is being collected.

| Returns |
|---|---|
| `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/core/telecom/CallEndpointCompat>>` | A `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html` that continuously emits a list of available `https://developer.android.com/reference/kotlin/androidx/core/telecom/CallEndpointCompat`s. |

### registerAppWithTelecom

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
@RequiresPermission(value = "android.permission.MANAGE_OWN_CALLS")
fun registerAppWithTelecom(
    capabilities: Int,
    backwardsCompatSdkLevel: Int = VERSION_CODES.TIRAMISU
): Unit
```

Registers the application with the Telecom framework.

VoIP applications should call this API during application setup to register their capabilities (e.g., video) before adding calls via `https://developer.android.com/reference/kotlin/androidx/core/telecom/CallsManager#addCall(androidx.core.telecom.CallAttributesCompat,kotlin.coroutines.SuspendFunction1,kotlin.coroutines.SuspendFunction1,kotlin.coroutines.SuspendFunction0,kotlin.coroutines.SuspendFunction0,kotlin.Function1)`.The library automatically handles unregistering any previous configuration.

**Note:** This method should not be called while there are active calls, as it may cause unexpected behavior or call disconnection.

Core-telecom abstracts two platform implementations: the legacy `ConnectionService` APIs and the modern transactional APIs (introduced in SDK 34). The `backwardsCompatSdkLevel` parameter allows you to control which implementation is used.

| Parameters |
|---|---|
| `capabilities: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The set of capabilities your application supports, such as `https://developer.android.com/reference/kotlin/androidx/core/telecom/CallsManager#CAPABILITY_SUPPORTS_VIDEO_CALLING()`. Value is either `0` or a combination of the following: - `1` - `2` - `4` - `8` <br /> |
| `backwardsCompatSdkLevel: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = VERSION_CODES.TIRAMISU` | Sets the highest SDK version (inclusive) that should be forced to use the legacy `ConnectionService` implementation. - **Default:** `VERSION_CODES.TIRAMISU` (33). This default ensures that all devices on SDK 34 and higher will use the modern transactional APIs. - **Behavior:** This parameter provides developers with the flexibility to prefer the behavior of the legacy implementation on specific OS versions. - **Clamping:** The provided value is automatically clamped to a safe range: it cannot be lower than `33` or higher than the current device's SDK version. For example, to force the legacy path on a device running SDK 35, you would pass in `35`. Passing in `40` on an SDK 35 device would be clamped to `35`. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unsupported-operation-exception/index.html` | if the device is on an invalid build |