AmbientTickEffect
@Composable
public fun AmbientModeManager.AmbientTickEffect(block: () -> Unit)
A convenience extension that performs recurrent, battery-efficient UI updates when the device is in AmbientMode.Ambient.
This extension handles the boilerplate for ambient tick synchronization: it automatically launches and manages a LaunchedEffect that repeatedly suspends using AmbientModeManager.withAmbientTick to align state updates with the system's infrequent ambient tick schedule.
The internal loop automatically terminates when the device returns to AmbientMode.Interactive.
Efficiency Note: The block lambda should only update the minimal androidx.compose.runtime.State required to prevent excessive recomposition and maximize battery life.
Example of using AmbientTickEffect:
Parameters
| block | The state update logic to execute once per ambient tick. |