# LifecycleOwner

Artifact: [androidx.lifecycle:lifecycle-common](https://developer.android.com/jetpack/androidx/releases/lifecycle) [View Source](https://cs.android.com/search?q=file:androidx/lifecycle/LifecycleOwner.kt+class:androidx.lifecycle.LifecycleOwner) Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/lifecycle#2.0.0)

*** ** * ** ***


```
public interface LifecycleOwner
```

<br />

Known direct subclasses [ActivityHolder](https://developer.android.com/reference/androidx/privacysandbox/sdkruntime/core/activity/ActivityHolder), [ComponentActivity](https://developer.android.com/reference/androidx/activity/ComponentActivity), [ComponentDialog](https://developer.android.com/reference/androidx/activity/ComponentDialog), [Fragment](https://developer.android.com/reference/androidx/fragment/app/Fragment), [InCallServiceCompat](https://developer.android.com/reference/androidx/core/telecom/InCallServiceCompat), [LifecycleRegistryOwner](https://developer.android.com/reference/androidx/lifecycle/LifecycleRegistryOwner), [LifecycleService](https://developer.android.com/reference/androidx/lifecycle/LifecycleService), [NavBackStackEntry](https://developer.android.com/reference/androidx/navigation/NavBackStackEntry), [OnBackPressedDispatcherOwner](https://developer.android.com/reference/androidx/activity/OnBackPressedDispatcherOwner), [ProcessLifecycleOwner](https://developer.android.com/reference/androidx/lifecycle/ProcessLifecycleOwner), [SavedStateRegistryOwner](https://developer.android.com/reference/androidx/savedstate/SavedStateRegistryOwner), [Screen](https://developer.android.com/reference/androidx/car/app/Screen), [Session](https://developer.android.com/reference/androidx/car/app/Session), [TestLifecycleOwner](https://developer.android.com/reference/androidx/lifecycle/testing/TestLifecycleOwner)

|---|---|
| `https://developer.android.com/reference/androidx/privacysandbox/sdkruntime/core/activity/ActivityHolder` | **This interface is deprecated.** This library is no longer supported. |
| `https://developer.android.com/reference/androidx/activity/ComponentActivity` | Base class for activities that enables composition of higher level components. |
| `https://developer.android.com/reference/androidx/activity/ComponentDialog` | Base class for dialogs that enables composition of higher level components. |
| `https://developer.android.com/reference/androidx/fragment/app/Fragment` | Static library support version of the framework's `https://developer.android.com/reference/android/app/Fragment.html`. |
| `https://developer.android.com/reference/androidx/core/telecom/InCallServiceCompat` | This class defines the Jetpack InCallService with the additional ability of defining a `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner` |
| `https://developer.android.com/reference/androidx/lifecycle/LifecycleRegistryOwner` | **This interface is deprecated.** Use `androidx.appcompat.app.AppCompatActivity` which extends `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner`, so there are no use cases for this class. <br /> |
| `https://developer.android.com/reference/androidx/lifecycle/LifecycleService` | A Service that is also a `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner`. |
| `https://developer.android.com/reference/androidx/navigation/NavBackStackEntry` | Representation of an entry in the back stack of a `https://developer.android.com/reference/androidx/navigation/NavController`. |
| `https://developer.android.com/reference/androidx/activity/OnBackPressedDispatcherOwner` | A class that has an `https://developer.android.com/reference/androidx/activity/OnBackPressedDispatcher` that allows you to register a `https://developer.android.com/reference/androidx/activity/OnBackPressedCallback` for handling the system back button. |
| `https://developer.android.com/reference/androidx/lifecycle/ProcessLifecycleOwner` | Class that provides lifecycle for the whole application process. |
| `https://developer.android.com/reference/androidx/savedstate/SavedStateRegistryOwner` | A scope that owns a `https://developer.android.com/reference/androidx/savedstate/SavedStateRegistry`. |
| `https://developer.android.com/reference/androidx/car/app/Screen` | A Screen has a `https://developer.android.com/reference/androidx/lifecycle/Lifecycle` and provides the mechanism for the app to send `https://developer.android.com/reference/androidx/car/app/model/Template`s to display when the Screen is visible. |
| `https://developer.android.com/reference/androidx/car/app/Session` | The base class for implementing a session for a car app. |
| `https://developer.android.com/reference/androidx/lifecycle/testing/TestLifecycleOwner` | Create a `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner` that allows changing the state via the `https://developer.android.com/reference/androidx/lifecycle/testing/TestLifecycleOwner#handleLifecycleEvent(androidx.lifecycle.Lifecycle.Event)` method or `https://developer.android.com/reference/androidx/lifecycle/testing/TestLifecycleOwner#currentState()` property. |

Known indirect subclasses [AbstractListDetailFragment](https://developer.android.com/reference/androidx/navigation/fragment/AbstractListDetailFragment), [AbstractProgressFragment](https://developer.android.com/reference/androidx/navigation/dynamicfeatures/fragment/ui/AbstractProgressFragment), [AlertDialog](https://developer.android.com/reference/androidx/appcompat/app/AlertDialog), [AmbientModeSupport](https://developer.android.com/reference/androidx/wear/ambient/AmbientModeSupport), [AppCompatActivity](https://developer.android.com/reference/androidx/appcompat/app/AppCompatActivity), [AppCompatDialogFragment](https://developer.android.com/reference/androidx/appcompat/app/AppCompatDialogFragment), [AppCompatDialog](https://developer.android.com/reference/androidx/appcompat/app/AppCompatDialog), [BaseCarAppActivity](https://developer.android.com/reference/androidx/car/app/activity/BaseCarAppActivity), [BaseLeanbackPreferenceFragmentCompat](https://developer.android.com/reference/androidx/leanback/preference/BaseLeanbackPreferenceFragmentCompat), [BaseSupportFragment](https://developer.android.com/reference/androidx/leanback/app/BaseSupportFragment), [BrandedSupportFragment](https://developer.android.com/reference/androidx/leanback/app/BrandedSupportFragment), [BrowseSupportFragment](https://developer.android.com/reference/androidx/leanback/app/BrowseSupportFragment), [CarAppActivity](https://developer.android.com/reference/androidx/car/app/activity/CarAppActivity), [ComponentActivity](https://developer.android.com/reference/androidx/activity/ComponentActivity), [ComponentDialog](https://developer.android.com/reference/androidx/activity/ComponentDialog), [DefaultProgressFragment](https://developer.android.com/reference/androidx/navigation/dynamicfeatures/fragment/ui/DefaultProgressFragment), [DetailsSupportFragment](https://developer.android.com/reference/androidx/leanback/app/DetailsSupportFragment), [DialogFragment](https://developer.android.com/reference/androidx/fragment/app/DialogFragment), [DynamicNavHostFragment](https://developer.android.com/reference/androidx/navigation/dynamicfeatures/fragment/DynamicNavHostFragment), [EditTextPreferenceDialogFragmentCompat](https://developer.android.com/reference/androidx/preference/EditTextPreferenceDialogFragmentCompat), [EditablePdfViewerFragment](https://developer.android.com/reference/androidx/pdf/ink/EditablePdfViewerFragment), [ErrorSupportFragment](https://developer.android.com/reference/androidx/leanback/app/ErrorSupportFragment), [FragmentActivity](https://developer.android.com/reference/androidx/fragment/app/FragmentActivity), [Fragment](https://developer.android.com/reference/androidx/fragment/app/Fragment), [GuidedStepSupportFragment](https://developer.android.com/reference/androidx/leanback/app/GuidedStepSupportFragment), [HeadersSupportFragment](https://developer.android.com/reference/androidx/leanback/app/HeadersSupportFragment), [LauncherActivity](https://developer.android.com/reference/androidx/car/app/activity/LauncherActivity), [LeanbackEditTextPreferenceDialogFragmentCompat](https://developer.android.com/reference/androidx/leanback/preference/LeanbackEditTextPreferenceDialogFragmentCompat), [LeanbackListPreferenceDialogFragmentCompat](https://developer.android.com/reference/androidx/leanback/preference/LeanbackListPreferenceDialogFragmentCompat), [LeanbackPreferenceDialogFragmentCompat](https://developer.android.com/reference/androidx/leanback/preference/LeanbackPreferenceDialogFragmentCompat), [LeanbackPreferenceFragmentCompat](https://developer.android.com/reference/androidx/leanback/preference/LeanbackPreferenceFragmentCompat), [LeanbackSettingsFragmentCompat](https://developer.android.com/reference/androidx/leanback/preference/LeanbackSettingsFragmentCompat), [ListFragment](https://developer.android.com/reference/androidx/fragment/app/ListFragment), [ListPreferenceDialogFragmentCompat](https://developer.android.com/reference/androidx/preference/ListPreferenceDialogFragmentCompat), [MediaLibraryService](https://developer.android.com/reference/androidx/media3/session/MediaLibraryService), [MediaRouteChooserDialogFragment](https://developer.android.com/reference/androidx/mediarouter/app/MediaRouteChooserDialogFragment), [MediaRouteChooserDialog](https://developer.android.com/reference/androidx/mediarouter/app/MediaRouteChooserDialog), [MediaRouteControllerDialogFragment](https://developer.android.com/reference/androidx/mediarouter/app/MediaRouteControllerDialogFragment), [MediaRouteControllerDialog](https://developer.android.com/reference/androidx/mediarouter/app/MediaRouteControllerDialog), [MediaRouteDiscoveryFragment](https://developer.android.com/reference/androidx/mediarouter/app/MediaRouteDiscoveryFragment), [MediaSessionService](https://developer.android.com/reference/androidx/media3/session/MediaSessionService), [MultiSelectListPreferenceDialogFragmentCompat](https://developer.android.com/reference/androidx/preference/MultiSelectListPreferenceDialogFragmentCompat), [NavBackStackEntry](https://developer.android.com/reference/androidx/navigation/NavBackStackEntry), [NavHostFragment](https://developer.android.com/reference/androidx/navigation/fragment/NavHostFragment), [OnboardingSupportFragment](https://developer.android.com/reference/androidx/leanback/app/OnboardingSupportFragment), [PdfViewerFragment](https://developer.android.com/reference/androidx/pdf/viewer/fragment/PdfViewerFragment), [PlaybackSupportFragment](https://developer.android.com/reference/androidx/leanback/app/PlaybackSupportFragment), [PreferenceDialogFragmentCompat](https://developer.android.com/reference/androidx/preference/PreferenceDialogFragmentCompat), [PreferenceFragmentCompat](https://developer.android.com/reference/androidx/preference/PreferenceFragmentCompat), [PreferenceHeaderFragmentCompat](https://developer.android.com/reference/androidx/preference/PreferenceHeaderFragmentCompat), [RowsSupportFragment](https://developer.android.com/reference/androidx/leanback/app/RowsSupportFragment), [SearchSupportFragment](https://developer.android.com/reference/androidx/leanback/app/SearchSupportFragment), [VerticalGridSupportFragment](https://developer.android.com/reference/androidx/leanback/app/VerticalGridSupportFragment), [VideoSupportFragment](https://developer.android.com/reference/androidx/leanback/app/VideoSupportFragment)

|---|---|
| `https://developer.android.com/reference/androidx/navigation/fragment/AbstractListDetailFragment` | A fragment supports adaptive two-pane layout. |
| `https://developer.android.com/reference/androidx/navigation/dynamicfeatures/fragment/ui/AbstractProgressFragment` | The base class for `https://developer.android.com/reference/androidx/fragment/app/Fragment`s that handle dynamic feature installation. |
| `https://developer.android.com/reference/androidx/appcompat/app/AlertDialog` | A subclass of Dialog that can display one, two or three buttons. |
| `https://developer.android.com/reference/androidx/wear/ambient/AmbientModeSupport` | **This class is deprecated.** Use `https://developer.android.com/reference/androidx/wear/ambient/AmbientLifecycleObserver` instead. <br /> |
| `https://developer.android.com/reference/androidx/appcompat/app/AppCompatActivity` | Base class for activities that wish to use some of the newer platform features on older Android devices. |
| `https://developer.android.com/reference/androidx/appcompat/app/AppCompatDialogFragment` | A special version of `https://developer.android.com/reference/androidx/fragment/app/DialogFragment` which uses an `https://developer.android.com/reference/androidx/appcompat/app/AppCompatDialog` in place of a platform-styled dialog. |
| `https://developer.android.com/reference/androidx/appcompat/app/AppCompatDialog` | Base class for AppCompat themed `https://developer.android.com/reference/android/app/Dialog.html`s. |
| `https://developer.android.com/reference/androidx/car/app/activity/BaseCarAppActivity` | Core logic for CarAppLibrary Activity interaction with a host. |
| `https://developer.android.com/reference/androidx/leanback/preference/BaseLeanbackPreferenceFragmentCompat` | This fragment provides a preference fragment with leanback-style behavior, suitable for embedding into broader UI elements. |
| `https://developer.android.com/reference/androidx/leanback/app/BaseSupportFragment` | Base class for leanback Fragments. |
| `https://developer.android.com/reference/androidx/leanback/app/BrandedSupportFragment` | Fragment class for managing search and branding using a view that implements `https://developer.android.com/reference/androidx/leanback/widget/TitleViewAdapter.Provider`. |
| `https://developer.android.com/reference/androidx/leanback/app/BrowseSupportFragment` | A fragment for creating Leanback browse screens. |
| `https://developer.android.com/reference/androidx/car/app/activity/CarAppActivity` | The class representing a car app activity in the main display. |
| `https://developer.android.com/reference/androidx/activity/ComponentActivity` | Base class for activities that enables composition of higher level components. |
| `https://developer.android.com/reference/androidx/activity/ComponentDialog` | Base class for dialogs that enables composition of higher level components. |
| `https://developer.android.com/reference/androidx/navigation/dynamicfeatures/fragment/ui/DefaultProgressFragment` | The default `https://developer.android.com/reference/androidx/fragment/app/Fragment` to display during installation progress. |
| `https://developer.android.com/reference/androidx/leanback/app/DetailsSupportFragment` | A fragment for creating Leanback details screens. |
| `https://developer.android.com/reference/androidx/fragment/app/DialogFragment` | A fragment that displays a dialog window, floating in the foreground of its activity's window. |
| `https://developer.android.com/reference/androidx/navigation/dynamicfeatures/fragment/DynamicNavHostFragment` | The `https://developer.android.com/reference/androidx/navigation/fragment/NavHostFragment` for dynamic features. |
| `https://developer.android.com/reference/androidx/preference/EditTextPreferenceDialogFragmentCompat` |   |
| `https://developer.android.com/reference/androidx/pdf/ink/EditablePdfViewerFragment` | A `https://developer.android.com/reference/androidx/fragment/app/Fragment` that extends `https://developer.android.com/reference/androidx/pdf/viewer/fragment/PdfViewerFragment` to provide PDF editing capabilities, including annotation and form filling, leveraging the 'androidx.ink' library. |
| `https://developer.android.com/reference/androidx/leanback/app/ErrorSupportFragment` | A fragment for displaying an error indication. |
| `https://developer.android.com/reference/androidx/fragment/app/FragmentActivity` | Base class for activities that want to use the support-based `https://developer.android.com/reference/androidx/fragment/app/Fragment`. |
| `https://developer.android.com/reference/androidx/fragment/app/Fragment` | Static library support version of the framework's `https://developer.android.com/reference/android/app/Fragment.html`. |
| `https://developer.android.com/reference/androidx/leanback/app/GuidedStepSupportFragment` | A GuidedStepSupportFragment is used to guide the user through a decision or series of decisions. |
| `https://developer.android.com/reference/androidx/leanback/app/HeadersSupportFragment` | An fragment containing a list of row headers. |
| `https://developer.android.com/reference/androidx/car/app/activity/LauncherActivity` | This class handles providing the right launcher activity when running native applications and Car App Library applications. |
| `https://developer.android.com/reference/androidx/leanback/preference/LeanbackEditTextPreferenceDialogFragmentCompat` | Implemented a dialog to input text. |
| `https://developer.android.com/reference/androidx/leanback/preference/LeanbackListPreferenceDialogFragmentCompat` | Implemented a dialog to show `https://developer.android.com/reference/androidx/preference/ListPreference` or `https://developer.android.com/reference/androidx/preference/MultiSelectListPreference`. |
| `https://developer.android.com/reference/androidx/leanback/preference/LeanbackPreferenceDialogFragmentCompat` | A fragment that shows `https://developer.android.com/reference/androidx/preference/DialogPreference`, for example `https://developer.android.com/reference/androidx/preference/ListPreference` or `https://developer.android.com/reference/androidx/preference/MultiSelectListPreference`. |
| `https://developer.android.com/reference/androidx/leanback/preference/LeanbackPreferenceFragmentCompat` | This fragment provides a fully decorated leanback-style preference fragment, including a list background and header. |
| `https://developer.android.com/reference/androidx/leanback/preference/LeanbackSettingsFragmentCompat` | This fragment provides a container for displaying a `https://developer.android.com/reference/androidx/leanback/preference/LeanbackPreferenceFragmentCompat` |
| `https://developer.android.com/reference/androidx/fragment/app/ListFragment` | Static library support version of the framework's `https://developer.android.com/reference/android/app/ListFragment.html`. |
| `https://developer.android.com/reference/androidx/preference/ListPreferenceDialogFragmentCompat` |   |
| `https://developer.android.com/reference/androidx/media3/session/MediaLibraryService` | Superclass to be extended by services hosting `https://developer.android.com/reference/androidx/media3/session/MediaLibraryService.MediaLibrarySession`. |
| `https://developer.android.com/reference/androidx/mediarouter/app/MediaRouteChooserDialogFragment` | Media route chooser dialog fragment. |
| `https://developer.android.com/reference/androidx/mediarouter/app/MediaRouteChooserDialog` | This class implements the route chooser dialog for `https://developer.android.com/reference/androidx/mediarouter/media/MediaRouter`. |
| `https://developer.android.com/reference/androidx/mediarouter/app/MediaRouteControllerDialogFragment` | Media route controller dialog fragment. |
| `https://developer.android.com/reference/androidx/mediarouter/app/MediaRouteControllerDialog` | This class implements the route controller dialog for `https://developer.android.com/reference/androidx/mediarouter/media/MediaRouter`. |
| `https://developer.android.com/reference/androidx/mediarouter/app/MediaRouteDiscoveryFragment` | Media route discovery fragment. |
| `https://developer.android.com/reference/androidx/media3/session/MediaSessionService` | Superclass to be extended by services hosting `https://developer.android.com/reference/androidx/media3/session/MediaSession`. |
| `https://developer.android.com/reference/androidx/preference/MultiSelectListPreferenceDialogFragmentCompat` |   |
| `https://developer.android.com/reference/androidx/navigation/NavBackStackEntry` | Representation of an entry in the back stack of a `https://developer.android.com/reference/androidx/navigation/NavController`. |
| `https://developer.android.com/reference/androidx/navigation/fragment/NavHostFragment` | NavHostFragment provides an area within your layout for self-contained navigation to occur. |
| `https://developer.android.com/reference/androidx/leanback/app/OnboardingSupportFragment` | An OnboardingSupportFragment provides a common and simple way to build onboarding screen for applications. |
| `https://developer.android.com/reference/androidx/pdf/viewer/fragment/PdfViewerFragment` | A Fragment that renders a PDF document. |
| `https://developer.android.com/reference/androidx/leanback/app/PlaybackSupportFragment` | A fragment for displaying playback controls and related content. |
| `https://developer.android.com/reference/androidx/preference/PreferenceDialogFragmentCompat` | Abstract base class which presents a dialog associated with a `https://developer.android.com/reference/androidx/preference/DialogPreference`. |
| `https://developer.android.com/reference/androidx/preference/PreferenceFragmentCompat` | A PreferenceFragmentCompat is the entry point to using the Preference library. |
| `https://developer.android.com/reference/androidx/preference/PreferenceHeaderFragmentCompat` | `https://developer.android.com/reference/androidx/preference/PreferenceHeaderFragmentCompat` implements a two-pane fragment for preferences. |
| `https://developer.android.com/reference/androidx/leanback/app/RowsSupportFragment` | An ordered set of rows of leanback widgets. |
| `https://developer.android.com/reference/androidx/leanback/app/SearchSupportFragment` | A fragment to handle searches. |
| `https://developer.android.com/reference/androidx/leanback/app/VerticalGridSupportFragment` | A fragment for creating leanback vertical grids. |
| `https://developer.android.com/reference/androidx/leanback/app/VideoSupportFragment` | Subclass of `https://developer.android.com/reference/androidx/leanback/app/PlaybackSupportFragment` that is responsible for providing a `https://developer.android.com/reference/android/view/SurfaceView.html` and rendering video. |

*** ** * ** ***

A class that exposes a `https://developer.android.com/reference/androidx/lifecycle/Lifecycle`.

Allows custom components to observe and react to lifecycle changes without tight coupling to the owner's implementation.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle` |   |

## Summary

| ### Public methods |
|---|---|
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/Lifecycle` | `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner#getLifecycle()()` The `https://developer.android.com/reference/androidx/lifecycle/Lifecycle` of this owner. |

| ### Extension functions |
|---|---|
| `default final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/LifecycleCoroutineScope` | `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwnerKt.https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner#(androidx.lifecycle.LifecycleOwner).getLifecycleScope()(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner receiver)` `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html` tied to this `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner`'s `https://developer.android.com/reference/androidx/lifecycle/Lifecycle`. |
| `default final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/activity/client/LocalManagedSdkActivityLauncher<@https://developer.android.com/reference/androidx/annotation/NonNull T>` | `<T extends https://developer.android.com/reference/android/app/Activity.html & https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner> https://developer.android.com/reference/androidx/lifecycle/SdkActivityLaunchers.[createManagedSdkActivityLauncher](https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner#(android.app.Activity).createManagedSdkActivityLauncher(kotlin.Function0))( @https://developer.android.com/reference/androidx/annotation/NonNull T receiver, @https://developer.android.com/reference/androidx/annotation/NonNull Function0<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Boolean.html> allowLaunch )` **This method is deprecated.** This library is no longer supported. |
| `default final @https://developer.android.com/reference/androidx/annotation/NonNull R` | `<R extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/lifecycle/WithLifecycleStateKt.https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner#(androidx.lifecycle.LifecycleOwner).withCreated(kotlin.Function0)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner receiver, @https://developer.android.com/reference/androidx/annotation/NonNull Function0<@https://developer.android.com/reference/androidx/annotation/NonNull R> block )` Run `https://developer.android.com/reference/androidx/lifecycle/package-summary#(androidx.lifecycle.LifecycleOwner).withCreated(kotlin.Function0)` with this `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner`'s `https://developer.android.com/reference/androidx/lifecycle/Lifecycle` in a `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State` of at least `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#CREATED` and resume with the result. |
| `default final @https://developer.android.com/reference/androidx/annotation/NonNull R` | `<R extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/lifecycle/WithLifecycleStateKt.https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner#(androidx.lifecycle.LifecycleOwner).withResumed(kotlin.Function0)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner receiver, @https://developer.android.com/reference/androidx/annotation/NonNull Function0<@https://developer.android.com/reference/androidx/annotation/NonNull R> block )` Run `https://developer.android.com/reference/androidx/lifecycle/package-summary#(androidx.lifecycle.LifecycleOwner).withResumed(kotlin.Function0)` with this `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner`'s `https://developer.android.com/reference/androidx/lifecycle/Lifecycle` in a `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State` of at least `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#RESUMED` and resume with the result. |
| `default final @https://developer.android.com/reference/androidx/annotation/NonNull R` | `<R extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/lifecycle/WithLifecycleStateKt.https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner#(androidx.lifecycle.LifecycleOwner).withStarted(kotlin.Function0)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner receiver, @https://developer.android.com/reference/androidx/annotation/NonNull Function0<@https://developer.android.com/reference/androidx/annotation/NonNull R> block )` Run `https://developer.android.com/reference/androidx/lifecycle/package-summary#(androidx.lifecycle.LifecycleOwner).withStarted(kotlin.Function0)` with this `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner`'s `https://developer.android.com/reference/androidx/lifecycle/Lifecycle` in a `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State` of at least `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#STARTED` and resume with the result. |
| `default final @https://developer.android.com/reference/androidx/annotation/NonNull R` | `<R extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/lifecycle/WithLifecycleStateKt.https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner#(androidx.lifecycle.LifecycleOwner).withStateAtLeast(androidx.lifecycle.Lifecycle.State,kotlin.Function0)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State state, @https://developer.android.com/reference/androidx/annotation/NonNull Function0<@https://developer.android.com/reference/androidx/annotation/NonNull R> block )` Run `https://developer.android.com/reference/androidx/lifecycle/package-summary#(androidx.lifecycle.LifecycleOwner).withStateAtLeast(androidx.lifecycle.Lifecycle.State,kotlin.Function0)` with this `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner`'s `https://developer.android.com/reference/androidx/lifecycle/Lifecycle` in a `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State` of at least `https://developer.android.com/reference/androidx/lifecycle/package-summary#(androidx.lifecycle.LifecycleOwner).withStateAtLeast(androidx.lifecycle.Lifecycle.State,kotlin.Function0)` and resume with the result. |

## Public methods

### getLifecycle

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

```
abstract @NonNull Lifecycle getLifecycle()
```

The `https://developer.android.com/reference/androidx/lifecycle/Lifecycle` of this owner.

## Extension functions

### LifecycleOwnerKt.getLifecycleScope

Artifact: [androidx.lifecycle:lifecycle-common](https://developer.android.com/jetpack/androidx/releases/lifecycle) [View Source](https://cs.android.com/search?q=file:androidx/lifecycle/LifecycleOwner.kt+symbol:lifecycleScope)

```
default final @NonNull LifecycleCoroutineScope LifecycleOwnerKt.getLifecycleScope(@NonNull LifecycleOwner receiver)
```

`https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html` tied to this `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner`'s `https://developer.android.com/reference/androidx/lifecycle/Lifecycle`.

Canceled when the `https://developer.android.com/reference/androidx/lifecycle/Lifecycle` is destroyed. Bound to `Dispatchers.Main.immediate`.

### SdkActivityLaunchers.createManagedSdkActivityLauncher

Artifact: [androidx.privacysandbox.activity:activity-client](https://developer.android.com/jetpack/androidx/releases/privacysandbox-activity) [View Source](https://cs.android.com/search?q=file:androidx/privacysandbox/activity/client/SdkActivityLaunchers.kt+function:createManagedSdkActivityLauncher)

```
default final @NonNull LocalManagedSdkActivityLauncher<@NonNull T> <T extends Activity & LifecycleOwner> SdkActivityLaunchers.[createManagedSdkActivityLauncher](https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner#(android.app.Activity).createManagedSdkActivityLauncher(kotlin.Function0))(
    @NonNull T receiver,
    @NonNull Function0<@NonNull Boolean> allowLaunch
)
```

> [!CAUTION]
> **This method is deprecated.**   
> This library is no longer supported.

Returns a lifecycle-aware SdkActivityLauncher that launches activities on behalf of an SDK by using this activity as a starting context. The created launcher will be automatically disposed when the current activity is destroyed, with no additional work required.

| Parameters |
|---|---|
| `<T extends https://developer.android.com/reference/android/app/Activity.html & https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner>` | the current `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner` activity from which new SDK activities will be launched. If this activity is destroyed, any further SDK activity launches will simply be ignored, and `https://developer.android.com/reference/androidx/privacysandbox/activity/client/LocalManagedSdkActivityLauncher#launchSdkActivity(android.os.IBinder)` will return 'false'. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull Function0<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Boolean.html> allowLaunch` | predicate called each time an activity is about to be launched by the SDK, the activity will only be launched if it returns true. |

### WithLifecycleStateKt.withCreated

Artifact: [androidx.lifecycle:lifecycle-runtime](https://developer.android.com/jetpack/androidx/releases/lifecycle) [View Source](https://cs.android.com/search?q=file:androidx/lifecycle/WithLifecycleState.kt+function:withCreated)

```
default final @NonNull R <R extends Object> WithLifecycleStateKt.withCreated(
    @NonNull LifecycleOwner receiver,
    @NonNull Function0<@NonNull R> block
)
```

Run `https://developer.android.com/reference/androidx/lifecycle/package-summary#(androidx.lifecycle.LifecycleOwner).withCreated(kotlin.Function0)` with this `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner`'s `https://developer.android.com/reference/androidx/lifecycle/Lifecycle` in a `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State` of at least `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#CREATED` and resume with the result. Throws the `https://developer.android.com/reference/androidx/lifecycle/LifecycleDestroyedException` if the lifecycle has reached `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#DESTROYED` by the time of the call or before `https://developer.android.com/reference/androidx/lifecycle/package-summary#(androidx.lifecycle.LifecycleOwner).withCreated(kotlin.Function0)` is able to run.

### WithLifecycleStateKt.withResumed

Artifact: [androidx.lifecycle:lifecycle-runtime](https://developer.android.com/jetpack/androidx/releases/lifecycle) [View Source](https://cs.android.com/search?q=file:androidx/lifecycle/WithLifecycleState.kt+function:withResumed)

```
default final @NonNull R <R extends Object> WithLifecycleStateKt.withResumed(
    @NonNull LifecycleOwner receiver,
    @NonNull Function0<@NonNull R> block
)
```

Run `https://developer.android.com/reference/androidx/lifecycle/package-summary#(androidx.lifecycle.LifecycleOwner).withResumed(kotlin.Function0)` with this `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner`'s `https://developer.android.com/reference/androidx/lifecycle/Lifecycle` in a `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State` of at least `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#RESUMED` and resume with the result. Throws the `https://developer.android.com/reference/androidx/lifecycle/LifecycleDestroyedException` if the lifecycle has reached `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#DESTROYED` by the time of the call or before `https://developer.android.com/reference/androidx/lifecycle/package-summary#(androidx.lifecycle.LifecycleOwner).withResumed(kotlin.Function0)` is able to run.

### WithLifecycleStateKt.withStarted

Artifact: [androidx.lifecycle:lifecycle-runtime](https://developer.android.com/jetpack/androidx/releases/lifecycle) [View Source](https://cs.android.com/search?q=file:androidx/lifecycle/WithLifecycleState.kt+function:withStarted)

```
default final @NonNull R <R extends Object> WithLifecycleStateKt.withStarted(
    @NonNull LifecycleOwner receiver,
    @NonNull Function0<@NonNull R> block
)
```

Run `https://developer.android.com/reference/androidx/lifecycle/package-summary#(androidx.lifecycle.LifecycleOwner).withStarted(kotlin.Function0)` with this `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner`'s `https://developer.android.com/reference/androidx/lifecycle/Lifecycle` in a `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State` of at least `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#STARTED` and resume with the result. Throws the `https://developer.android.com/reference/androidx/lifecycle/LifecycleDestroyedException` if the lifecycle has reached `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#DESTROYED` by the time of the call or before `https://developer.android.com/reference/androidx/lifecycle/package-summary#(androidx.lifecycle.LifecycleOwner).withStarted(kotlin.Function0)` is able to run.

### WithLifecycleStateKt.withStateAtLeast

Artifact: [androidx.lifecycle:lifecycle-runtime](https://developer.android.com/jetpack/androidx/releases/lifecycle) [View Source](https://cs.android.com/search?q=file:androidx/lifecycle/WithLifecycleState.kt+function:withStateAtLeast)

```
default final @NonNull R <R extends Object> WithLifecycleStateKt.withStateAtLeast(
    @NonNull LifecycleOwner receiver,
    @NonNull Lifecycle.State state,
    @NonNull Function0<@NonNull R> block
)
```

Run `https://developer.android.com/reference/androidx/lifecycle/package-summary#(androidx.lifecycle.LifecycleOwner).withStateAtLeast(androidx.lifecycle.Lifecycle.State,kotlin.Function0)` with this `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner`'s `https://developer.android.com/reference/androidx/lifecycle/Lifecycle` in a `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State` of at least `https://developer.android.com/reference/androidx/lifecycle/package-summary#(androidx.lifecycle.LifecycleOwner).withStateAtLeast(androidx.lifecycle.Lifecycle.State,kotlin.Function0)` and resume with the result. Throws the `https://developer.android.com/reference/androidx/lifecycle/LifecycleDestroyedException` if the lifecycle has reached `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#DESTROYED` by the time of the call or before `https://developer.android.com/reference/androidx/lifecycle/package-summary#(androidx.lifecycle.LifecycleOwner).withStateAtLeast(androidx.lifecycle.Lifecycle.State,kotlin.Function0)` is able to run.