androidx.glance.appwidget.state

Top-level functions summary

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

Retrieve the state of an app widget.

suspend Unit
updateAppWidgetState(
    context: Context,
    glanceId: GlanceId,
    updateState: suspend (MutablePreferences) -> Unit
)

Update the state of an app widget using the global PreferencesGlanceStateDefinition.

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

Update the state of an app widget.

Extension functions summary

suspend T
<T : Any?> GlanceAppWidget.getAppWidgetState(
    context: Context,
    glanceId: GlanceId
)

Get the state of an App Widget.

Top-level functions

getAppWidgetState

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

Retrieve the state of an app widget.

The state definition must be the one used for that particular app widget.

updateAppWidgetState

suspend fun updateAppWidgetState(
    context: Context,
    glanceId: GlanceId,
    updateState: suspend (MutablePreferences) -> Unit
): Unit

Update the state of an app widget using the global PreferencesGlanceStateDefinition.

The state definition must be the one used for that particular app widget.

updateAppWidgetState

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

Update the state of an app widget.

The state definition must be the one used for that particular app widget.

Extension functions

getAppWidgetState

suspend fun <T : Any?> GlanceAppWidget.getAppWidgetState(
    context: Context,
    glanceId: GlanceId
): T

Get the state of an App Widget.