compose
Function
Android
suspend fun GlanceAppWidget.compose(
@Suppress("ContextFirst") context: Context,
id: GlanceId = createFakeAppWidgetId(),
options: Bundle? = null,
size: DpSize? = null,
state: Any? = null,
): RemoteViews
Creates a snapshot of the GlanceAppWidget
content without running recomposition.
This runs the composition one time and translates it to RemoteViews
.
If a valid id
is provided, this function will use the sizing values from the bound widget if
using SizeMode.Exact
or SizeMode.Single
.
Only one instance of compose for a particular id
may run at the same time. Calling compose
concurrently with the same ID will succeed, but the first call will resume with an exception.
If you need to call compose concurrently, you can omit id
so that a random fake ID will be
used. Otherwise, call compose sequentially when using the same id
.