AmbientAware

fun AmbientAware(isAlwaysOnScreen: Boolean = true, block: @Composable (AmbientStateUpdate) -> Unit)

Composable for general handling of changes and updates to ambient status. A new AmbientStateUpdate is generated with any change of ambient state, as well as with any periodic update generated whilst the screen is in ambient mode.

This composable changes the behavior of the activity, enabling Always-On. See:

https://developer.android.com/training/wearables/views/always-on).

It should therefore be used high up in the tree of composables.

Parameters

isAlwaysOnScreen

If supplied, this indicates whether always-on should be enabled. This can be used to ensure that some screens display an ambient-mode version, whereas others do not, for example, a workout screen vs a end-of-workout summary screen.

block

Lambda that will be used for building the UI, which is passed the current ambient state.