# AssociateWithGlanceWearWidget

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


```
@Target(allowedTargets = [AnnotationTarget.CLASS])
@Retention(value = AnnotationRetention.RUNTIME)
annotation AssociateWithGlanceWearWidget
```

<br />

*** ** * ** ***

Annotation used to associate a `https://developer.android.com/reference/kotlin/androidx/glance/wear/GlanceWearWidget` class with its corresponding `https://developer.android.com/reference/kotlin/androidx/glance/wear/GlanceWearWidgetService`.

This association must be used in `https://developer.android.com/reference/kotlin/androidx/glance/wear/GlanceWearWidgetService` to specify which associated widget class it has in its `widget` property. It must match the exact class name of the widget class used in the property.

This annotation is required so that the `https://developer.android.com/reference/kotlin/androidx/glance/wear/GlanceWearWidget` class can be resolved statically from the associated service's metadata without instantiating the service, avoiding initialization issues in services that use dependency injection (e.g., Hilt/Dagger).

For example:

```kotlin
@AssociateWithGlanceWearWidget(MyGlanceWearWidget::class)
class MyGlanceWearWidgetService : GlanceWearWidgetService() {
    override val widget = MyGlanceWearWidget()
}
```

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/glance/wear/AssociateWithGlanceWearWidget#AssociateWithGlanceWearWidget(kotlin.reflect.KClass)(value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html<https://developer.android.com/reference/kotlin/androidx/glance/wear/GlanceWearWidget>)` |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html<https://developer.android.com/reference/kotlin/androidx/glance/wear/GlanceWearWidget>` | `https://developer.android.com/reference/kotlin/androidx/glance/wear/AssociateWithGlanceWearWidget#value()` |

## Public constructors

### AssociateWithGlanceWearWidget

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

```
AssociateWithGlanceWearWidget(value: KClass<GlanceWearWidget>)
```

## Public properties

### value

```
val value: KClass<GlanceWearWidget>
```