# RequiresFeature

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

*** ** * ** ***

Common/AllAndroid/JVM
- Cmn

  ```
  @Retention(value = AnnotationRetention.SOURCE)
  @Target(allowedTargets = [AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.CLASS, AnnotationTarget.FIELD, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.CONSTRUCTOR])
  annotation RequiresFeature
  ```

*** ** * ** ***

Denotes that the annotated element requires one or more features. This is used to auto-generate documentation, and more importantly: to ensure correct usage in application code, where lint and Android Studio can check that calls marked with this annotation is surrounded by has-feature calls, referenced via the `https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature#enforcement()` attribute.

## Summary

| ### Public constructors |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature#RequiresFeature(kotlin.String,kotlin.String)(name: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, enforcement: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` | Cmn |

| ### Public properties |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature#enforcement()` Defines the name of the method that should be called to check whether the feature is available, using the same signature format as javadoc. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature#name()` The name of the feature that is required. | Cmn |

## Public constructors

### RequiresFeature

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/annotation#1.10.0)

```
RequiresFeature(name: String, enforcement: String)
```

## Public properties

### enforcement

Cmn

```
val enforcement: String
```

Defines the name of the method that should be called to check whether the feature is available, using the same signature format as javadoc. The feature checking method can have multiple parameters, but the feature name parameter must be of type String and must also be the first String-type parameter.

### name

Cmn

```
val name: String
```

The name of the feature that is required.