androidx.glance.wear.tiles.state

Top-level functions summary

suspend T
<T : Any?> getWearTileState(
    context: Context,
    definition: GlanceStateDefinition<T>,
    glanceId: GlanceId
)

Retrieve the state of a wear tile.

suspend T
<T : Any?> updateWearTileState(
    context: Context,
    definition: GlanceStateDefinition<T>,
    glanceId: GlanceId,
    updateState: suspend (T) -> T
)

Update the state of a wear tile.

Top-level functions

getWearTileState

suspend fun <T : Any?> getWearTileState(
    context: Context,
    definition: GlanceStateDefinition<T>,
    glanceId: GlanceId
): T

Retrieve the state of a wear tile.

The state definition must be the one used for that particular wear tile.

Parameters
context: Context

the context used to create this state

definition: GlanceStateDefinition<T>

the configuration that defines this state

glanceId: GlanceId

the glance id of this particular tile service

updateWearTileState

suspend fun <T : Any?> updateWearTileState(
    context: Context,
    definition: GlanceStateDefinition<T>,
    glanceId: GlanceId,
    updateState: suspend (T) -> T
): T

Update the state of a wear tile.

The state definition must be the one used for this particular tile service.

Parameters
context: Context

the context used to create this state

definition: GlanceStateDefinition<T>

the configuration that defines this state

glanceId: GlanceId

the glance id of this particular tile service

updateState: suspend (T) -> T

the block defines how the state to be updated