# ManagedActivityResultLauncher

Artifact: [androidx.activity:activity-compose](https://developer.android.com/jetpack/androidx/releases/activity) [View Source](https://cs.android.com/search?q=file:androidx/activity/compose/ActivityResultRegistry.kt+class:androidx.activity.compose.ManagedActivityResultLauncher) Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/activity#1.3.0)


```
class ManagedActivityResultLauncher<I : Any?, O : Any?> : ActivityResultLauncher<I>
```

<br />

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||
| ↳ | [androidx.activity.result.ActivityResultLauncher](https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResultLauncher)\<I\> ||
|   | ↳ | [androidx.activity.compose.ManagedActivityResultLauncher](https://developer.android.com/reference/kotlin/androidx/activity/compose/ManagedActivityResultLauncher) |

*** ** * ** ***

A launcher for a previously-`https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResultCaller#registerForActivityResult(androidx.activity.result.contract.ActivityResultContract,androidx.activity.result.ActivityResultCallback)` to start the process of executing an `https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContract`.

This launcher does not support the `https://developer.android.com/reference/kotlin/androidx/activity/compose/ManagedActivityResultLauncher#unregister()` function. Attempting to use `https://developer.android.com/reference/kotlin/androidx/activity/compose/ManagedActivityResultLauncher#unregister()` will result in an `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html`.

| Parameters |
|---|---|
| `<I : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?>` | type of the input required to launch |

## Summary

| ### Public functions |
|---|---|
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/activity/compose/ManagedActivityResultLauncher#launch(kotlin.Any,androidx.core.app.ActivityOptionsCompat)(input: I, options: https://developer.android.com/reference/kotlin/androidx/core/app/ActivityOptionsCompat?)` Executes an `https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContract` given the required `https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResultLauncher#launch(kotlin.Any,androidx.core.app.ActivityOptionsCompat)` and optional `https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResultLauncher#launch(kotlin.Any,androidx.core.app.ActivityOptionsCompat)` for how the Activity should be started. |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[unregister](https://developer.android.com/reference/kotlin/androidx/activity/compose/ManagedActivityResultLauncher#unregister())()` **This function is deprecated.** Registration is automatically handled by rememberLauncherForActivityResult |

| ### Public properties |
|---|---|
| `open https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContract<I, O>` | `https://developer.android.com/reference/kotlin/androidx/activity/compose/ManagedActivityResultLauncher#contract()` Returns the `https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContract` that was used to create this launcher. |

### Inherited functions

From [androidx.activity.result.ActivityResultLauncher](https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResultLauncher) `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResultLauncher#launch(kotlin.Any)(input: I)`

Executes an `https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContract` given the required `https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResultLauncher#launch(kotlin.Any)`.

## Public functions

### launch

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

```
open fun launch(input: I, options: ActivityOptionsCompat?): Unit
```

Executes an `https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContract` given the required `https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResultLauncher#launch(kotlin.Any,androidx.core.app.ActivityOptionsCompat)` and optional `https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResultLauncher#launch(kotlin.Any,androidx.core.app.ActivityOptionsCompat)` for how the Activity should be started.

This method throws `https://developer.android.com/reference/android/content/ActivityNotFoundException.html` if there was no Activity found to run the given Intent.

| Throws |
|---|---|
| `https://developer.android.com/reference/android/content/ActivityNotFoundException.html` |   |

### unregister

Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/activity#1.3.0) Deprecated in [1.3.0](https://developer.android.com/jetpack/androidx/releases/activity#1.3.0)

```
open fun [unregister](https://developer.android.com/reference/kotlin/androidx/activity/compose/ManagedActivityResultLauncher#unregister())(): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
> Registration is automatically handled by rememberLauncherForActivityResult

This function should never be called and doing so will result in an `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unsupported-operation-exception/index.html`.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unsupported-operation-exception/index.html` | if this function is called. |

## Public properties

### contract

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

```
open val contract: ActivityResultContract<I, O>
```

Returns the `https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContract` that was used to create this launcher.