# MultiProcessGlanceAppWidget

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


```
abstract class MultiProcessGlanceAppWidget : GlanceAppWidget
```

<br />

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||
| ↳ | [androidx.glance.appwidget.GlanceAppWidget](https://developer.android.com/reference/kotlin/androidx/glance/appwidget/GlanceAppWidget) ||
|   | ↳ | [androidx.glance.appwidget.multiprocess.MultiProcessGlanceAppWidget](https://developer.android.com/reference/kotlin/androidx/glance/appwidget/multiprocess/MultiProcessGlanceAppWidget) |

*** ** * ** ***

MultiProcessGlanceAppWidget can be used with `https://developer.android.com/reference/kotlin/androidx/glance/appwidget/GlanceAppWidgetReceiver` to support multiprocess use cases where different widget receivers run in different processes. Note that the worker must still run in the same process as the receiver.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/glance/appwidget/multiprocess/MultiProcessGlanceAppWidget#MultiProcessGlanceAppWidget(kotlin.Int)(errorUiLayout: @https://developer.android.com/reference/kotlin/androidx/annotation/LayoutRes https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` |

| ### Public functions |
|---|---|
| `open https://developer.android.com/reference/kotlin/androidx/glance/appwidget/multiprocess/MultiProcessConfig?` | `https://developer.android.com/reference/kotlin/androidx/glance/appwidget/multiprocess/MultiProcessGlanceAppWidget#getMultiProcessConfig(android.content.Context)(context: https://developer.android.com/reference/android/content/Context.html)` Override `https://developer.android.com/reference/kotlin/androidx/glance/appwidget/multiprocess/MultiProcessGlanceAppWidget#getMultiProcessConfig(android.content.Context)` to provide a `https://developer.android.com/reference/kotlin/androidx/work/multiprocess/RemoteWorkerService` that runs in the same process as the `https://developer.android.com/reference/kotlin/androidx/glance/appwidget/GlanceAppWidgetReceiver` that this is attached to. |

| ### Inherited functions |
|---|
| From [androidx.glance.appwidget.GlanceAppWidget](https://developer.android.com/reference/kotlin/androidx/glance/appwidget/GlanceAppWidget) |---|---| | `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/glance/appwidget/GlanceAppWidget#onCompositionError(android.content.Context,androidx.glance.GlanceId,kotlin.Int,kotlin.Throwable)( context: https://developer.android.com/reference/android/content/Context.html, glanceId: https://developer.android.com/reference/kotlin/androidx/glance/GlanceId, appWidgetId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, throwable: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html )` A callback invoked when the `https://developer.android.com/reference/kotlin/androidx/glance/appwidget/AppWidgetSession` encounters an exception. | | `open suspend https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/glance/appwidget/GlanceAppWidget#onDelete(android.content.Context,androidx.glance.GlanceId)(context: https://developer.android.com/reference/android/content/Context.html, glanceId: https://developer.android.com/reference/kotlin/androidx/glance/GlanceId)` Method called by the framework when an App Widget has been removed from its host. | | `abstract suspend https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/glance/appwidget/GlanceAppWidget#provideGlance(android.content.Context,androidx.glance.GlanceId)(context: https://developer.android.com/reference/android/content/Context.html, id: https://developer.android.com/reference/kotlin/androidx/glance/GlanceId)` Override this function to provide the Glance Composable. | | `open suspend https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/glance/appwidget/GlanceAppWidget#providePreview(android.content.Context,kotlin.Int)(context: https://developer.android.com/reference/android/content/Context.html, widgetCategory: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Override this function to provide a Glance Composable that will be used when running this widget in preview mode. | | `suspend https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/glance/appwidget/GlanceAppWidget#update(android.content.Context,androidx.glance.GlanceId)(context: https://developer.android.com/reference/android/content/Context.html, id: https://developer.android.com/reference/kotlin/androidx/glance/GlanceId)` Run the composition in `https://developer.android.com/reference/kotlin/androidx/glance/appwidget/GlanceAppWidget#provideGlance(android.content.Context,androidx.glance.GlanceId)` and send the result to `https://developer.android.com/reference/android/appwidget/AppWidgetManager.html`. | |

| ### Inherited properties |
|---|
| From [androidx.glance.appwidget.GlanceAppWidget](https://developer.android.com/reference/kotlin/androidx/glance/appwidget/GlanceAppWidget) |---|---| | `open https://developer.android.com/reference/kotlin/androidx/glance/appwidget/PreviewSizeMode` | `https://developer.android.com/reference/kotlin/androidx/glance/appwidget/GlanceAppWidget#previewSizeMode()` Defines handling of sizes for previews. | | `open https://developer.android.com/reference/kotlin/androidx/glance/appwidget/SizeMode` | `https://developer.android.com/reference/kotlin/androidx/glance/appwidget/GlanceAppWidget#sizeMode()` Defines the handling of sizes. | | `open https://developer.android.com/reference/kotlin/androidx/glance/state/GlanceStateDefinition<*>?` | `https://developer.android.com/reference/kotlin/androidx/glance/appwidget/GlanceAppWidget#stateDefinition()` Data store for widget data specific to the view. | |

## Public constructors

### MultiProcessGlanceAppWidget

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

```
MultiProcessGlanceAppWidget(
    errorUiLayout: @LayoutRes Int = R.layout.glance_error_layout
)
```

## Public functions

### getMultiProcessConfig

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

```
open fun getMultiProcessConfig(context: Context): MultiProcessConfig?
```

Override `https://developer.android.com/reference/kotlin/androidx/glance/appwidget/multiprocess/MultiProcessGlanceAppWidget#getMultiProcessConfig(android.content.Context)` to provide a `https://developer.android.com/reference/kotlin/androidx/work/multiprocess/RemoteWorkerService` that runs in the same process as the `https://developer.android.com/reference/kotlin/androidx/glance/appwidget/GlanceAppWidgetReceiver` that this is attached to.

If null, then this widget will be run with normal WorkManager, i.e. the same behavior as GlanceAppWidget.

If running in a non-default process, you should also declare a subclass of `https://developer.android.com/reference/kotlin/androidx/glance/appwidget/MyPackageReplacedReceiver` in AndroidManifest.xml for that process, in order to handle `https://developer.android.com/reference/android/content/Intent.html#ACTION_MY_PACKAGE_REPLACED` broadcasts.