LifecycleResumeEffect
Schedule a pair of effects to run when the Lifecycle receives either a Lifecycle.Event.ON_RESUME or Lifecycle.Event.ON_PAUSE (or any new unique value of key1). The ON_RESUME effect will be the body of the effects block and the ON_PAUSE effect will be within the (onPauseOrDispose clause)LifecycleResumePauseEffectScope.onPauseOrDispose:
LifecycleResumeEffect(lifecycleOwner) {
// add ON_RESUME effect here
onPauseOrDispose {
// add clean up for work kicked off in the ON_RESUME effect here
}
}
A LifecycleResumeEffect must include an onPauseOrDispose clause as the final statement in its effects block. If your operation does not require an effect for both Lifecycle.Event.ON_RESUME and Lifecycle.Event.ON_PAUSE, a LifecycleEventEffect should be used instead.
A LifecycleResumeEffect's key is a value that defines the identity of the effect. If a key changes, the LifecycleResumeEffect must dispose its current effects and reset by calling effects again. Examples of keys include:
Observable objects that the effect subscribes to
Unique request parameters to an operation that must cancel and retry if those parameters change
This function uses a Lifecycle.Observer to listen for when LifecycleResumeEffect enters the composition and the effects will be launched when receiving a Lifecycle.Event.ON_RESUME or Lifecycle.Event.ON_PAUSE event, respectively. If the LifecycleResumeEffect leaves the composition prior to receiving an Lifecycle.Event.ON_PAUSE event, onPauseOrDispose will be called to clean up the work that was kicked off in the ON_RESUME effect.
This function should not be used to launch tasks in response to callback events by way of storing callback data as a Lifecycle.State in a MutableState. Instead, see currentStateAsState to obtain a State
Parameters
The unique value to trigger recomposition upon change
The lifecycle owner to attach an observer
The effects to be launched when we receive the respective event callbacks
Schedule a pair of effects to run when the Lifecycle receives either a Lifecycle.Event.ON_RESUME or Lifecycle.Event.ON_PAUSE (or any new unique value of key1 or key2). The ON_RESUME effect will be the body of the effects block and the ON_PAUSE effect will be within the (onPauseOrDispose clause)LifecycleResumePauseEffectScope.onPauseOrDispose:
LifecycleResumeEffect(lifecycleOwner) {
// add ON_RESUME effect here
onPauseOrDispose {
// add clean up for work kicked off in the ON_RESUME effect here
}
}
A LifecycleResumeEffect must include an onPauseOrDispose clause as the final statement in its effects block. If your operation does not require an effect for both Lifecycle.Event.ON_RESUME and Lifecycle.Event.ON_PAUSE, a LifecycleEventEffect should be used instead.
A LifecycleResumeEffect's key is a value that defines the identity of the effect. If a key changes, the LifecycleResumeEffect must dispose its current effects and reset by calling effects again. Examples of keys include:
Observable objects that the effect subscribes to
Unique request parameters to an operation that must cancel and retry if those parameters change
This function uses a Lifecycle.Observer to listen for when LifecycleResumeEffect enters the composition and the effects will be launched when receiving a Lifecycle.Event.ON_RESUME or Lifecycle.Event.ON_PAUSE event, respectively. If the LifecycleResumeEffect leaves the composition prior to receiving an Lifecycle.Event.ON_PAUSE event, onPauseOrDispose will be called to clean up the work that was kicked off in the ON_RESUME effect.
This function should not be used to launch tasks in response to callback events by way of storing callback data as a Lifecycle.State in a MutableState. Instead, see currentStateAsState to obtain a State
Parameters
A unique value to trigger recomposition upon change
A unique value to trigger recomposition upon change
The lifecycle owner to attach an observer
The effects to be launched when we receive the respective event callbacks
Schedule a pair of effects to run when the Lifecycle receives either a Lifecycle.Event.ON_RESUME or Lifecycle.Event.ON_PAUSE (or any new unique value of key1 or key2 or key3). The ON_RESUME effect will be the body of the effects block and the ON_PAUSE effect will be within the (onPauseOrDispose clause)LifecycleResumePauseEffectScope.onPauseOrDispose:
LifecycleResumeEffect(lifecycleOwner) {
// add ON_RESUME effect here
onPauseOrDispose {
// add clean up for work kicked off in the ON_RESUME effect here
}
}
A LifecycleResumeEffect must include an onPauseOrDispose clause as the final statement in its effects block. If your operation does not require an effect for both Lifecycle.Event.ON_RESUME and Lifecycle.Event.ON_PAUSE, a LifecycleEventEffect should be used instead.
A LifecycleResumeEffect's key is a value that defines the identity of the effect. If a key changes, the LifecycleResumeEffect must dispose its current effects and reset by calling effects again. Examples of keys include:
Observable objects that the effect subscribes to
Unique request parameters to an operation that must cancel and retry if those parameters change
This function uses a Lifecycle.Observer to listen for when LifecycleResumeEffect enters the composition and the effects will be launched when receiving a Lifecycle.Event.ON_RESUME or Lifecycle.Event.ON_PAUSE event, respectively. If the LifecycleResumeEffect leaves the composition prior to receiving an Lifecycle.Event.ON_PAUSE event, onPauseOrDispose will be called to clean up the work that was kicked off in the ON_RESUME effect.
This function should not be used to launch tasks in response to callback events by way of storing callback data as a Lifecycle.State in a MutableState. Instead, see currentStateAsState to obtain a State
Parameters
A unique value to trigger recomposition upon change
A unique value to trigger recomposition upon change
A unique value to trigger recomposition upon change
The lifecycle owner to attach an observer
The effects to be launched when we receive the respective event callbacks
Schedule a pair of effects to run when the Lifecycle receives either a Lifecycle.Event.ON_RESUME or Lifecycle.Event.ON_PAUSE (or any new unique value of keys). The ON_RESUME effect will be the body of the effects block and the ON_PAUSE effect will be within the (onPauseOrDispose clause)LifecycleResumePauseEffectScope.onPauseOrDispose:
LifecycleResumeEffect(lifecycleOwner) {
// add ON_RESUME effect here
onPauseOrDispose {
// add clean up for work kicked off in the ON_RESUME effect here
}
}
A LifecycleResumeEffect must include an onPauseOrDispose clause as the final statement in its effects block. If your operation does not require an effect for both Lifecycle.Event.ON_RESUME and Lifecycle.Event.ON_PAUSE, a LifecycleEventEffect should be used instead.
A LifecycleResumeEffect's key is a value that defines the identity of the effect. If a key changes, the LifecycleResumeEffect must dispose its current effects and reset by calling effects again. Examples of keys include:
Observable objects that the effect subscribes to
Unique request parameters to an operation that must cancel and retry if those parameters change
This function uses a Lifecycle.Observer to listen for when LifecycleResumeEffect enters the composition and the effects will be launched when receiving a Lifecycle.Event.ON_RESUME or Lifecycle.Event.ON_PAUSE event, respectively. If the LifecycleResumeEffect leaves the composition prior to receiving an Lifecycle.Event.ON_PAUSE event, onPauseOrDispose will be called to clean up the work that was kicked off in the ON_RESUME effect.
This function should not be used to launch tasks in response to callback events by way of storing callback data as a Lifecycle.State in a MutableState. Instead, see currentStateAsState to obtain a State
Parameters
The unique values to trigger recomposition upon changes
The lifecycle owner to attach an observer
The effects to be launched when we receive the respective event callbacks