updateAppWidgetState

Function

Android
suspend fun <T> 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.

Android
suspend fun updateAppWidgetState(
    context: Context,
    glanceId: GlanceId,
    updateState: suspend (MutablePreferences) -> 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.