# GlanceRemoteViews

# GlanceRemoteViews

Artifact:[androidx.glance:glance-appwidget](https://developer.android.com/jetpack/androidx/releases/glance)  
[View Source](https://cs.android.com/search?q=file:androidx/glance/appwidget/GlanceRemoteViews.kt+class:androidx.glance.appwidget.GlanceRemoteViews)  
Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/glance#1.0.0)

<br />

```
@ExperimentalGlanceRemoteViewsApi
class GlanceRemoteViews
```

<br />

*** ** * ** ***

Object containing the information needed to generate a[RemoteViews](https://developer.android.com/reference/android/widget/RemoteViews.html). The same instance should be reused to compose layouts for a host view.

## Summary

|                                                         ### Public constructors                                                         |
|-----------------------------------------------------------------------------------------------------------------------------------------|
| [GlanceRemoteViews](https://developer.android.com/reference/kotlin/androidx/glance/appwidget/GlanceRemoteViews#GlanceRemoteViews())`()` |

|                                                              ### Public functions                                                               |
|-------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `suspend `[RemoteViewsCompositionResult](https://developer.android.com/reference/kotlin/androidx/glance/appwidget/RemoteViewsCompositionResult) | [compose](https://developer.android.com/reference/kotlin/androidx/glance/appwidget/GlanceRemoteViews#compose(android.content.Context,androidx.compose.ui.unit.DpSize,kotlin.Any,android.os.Bundle,kotlin.Function0))`(` ` context: `[Context](https://developer.android.com/reference/android/content/Context.html)`,` ` size: `[DpSize](https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize)`,` ` state: `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`?,` ` appWidgetOptions: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`,` ` content: @`[Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable)` () `->` `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) `)` Triggers the composition of[content](https://developer.android.com/reference/kotlin/androidx/glance/appwidget/GlanceRemoteViews#compose(android.content.Context,androidx.compose.ui.unit.DpSize,kotlin.Any,android.os.Bundle,kotlin.Function0))and returns the result. |

## Public constructors

### GlanceRemoteViews

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/glance#1.0.0)  

```
GlanceRemoteViews()
```  

## Public functions

### compose

```
suspend fun compose(
    context: Context,
    size: DpSize,
    state: Any? = null,
    appWidgetOptions: Bundle = Bundle(),
    content: @Composable () -> Unit
): RemoteViewsCompositionResult
```

Triggers the composition of[content](https://developer.android.com/reference/kotlin/androidx/glance/appwidget/GlanceRemoteViews#compose(android.content.Context,androidx.compose.ui.unit.DpSize,kotlin.Any,android.os.Bundle,kotlin.Function0))and returns the result.  

|                                                                                              Parameters                                                                                              |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `context: `[Context](https://developer.android.com/reference/android/content/Context.html)                                                                                                           | The[Context](https://developer.android.com/reference/android/content/Context.html)to get the resources during[RemoteViews](https://developer.android.com/reference/android/widget/RemoteViews.html)building.                                                           |
| `size: `[DpSize](https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize)                                                                                                     | Size of the[RemoteViews](https://developer.android.com/reference/android/widget/RemoteViews.html)to be displayed at.                                                                                                                                                   |
| `state: `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`? = null`                                                                                                       | Local view state that can be passed to composition through[LocalState](https://developer.android.com/reference/kotlin/androidx/glance/package-summary#LocalState()).                                                                                                   |
| `appWidgetOptions: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` = Bundle()`                                                                                            | AppWidget options[Bundle](https://developer.android.com/reference/android/os/Bundle.html)to be passed to composition through[LocalAppWidgetOptions](https://developer.android.com/reference/kotlin/androidx/glance/appwidget/package-summary#LocalAppWidgetOptions()). |
| `content: @`[Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable)` () `->` `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | Definition of the UI.                                                                                                                                                                                                                                                  |

|                                                                Returns                                                                |
|---------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------|
| [RemoteViewsCompositionResult](https://developer.android.com/reference/kotlin/androidx/glance/appwidget/RemoteViewsCompositionResult) | Composition result containing the[RemoteViews](https://developer.android.com/reference/android/widget/RemoteViews.html). |