# RequiresApi

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

*** ** * ** ***

Common/AllAndroid/JVM
- Cmn

  ```
  @MustBeDocumented
  @Retention(value = AnnotationRetention.BINARY)
  @Target(allowedTargets = [AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FIELD, AnnotationTarget.FILE])
  @OptionalExpectation
  annotation RequiresApi
  ```
- android

  ```
  @MustBeDocumented
  @Retention(value = AnnotationRetention.BINARY)
  @Target(allowedTargets = [AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FIELD, AnnotationTarget.FILE])
  @Target(value = [ElementType.ANNOTATION_TYPE, ElementType.TYPE, ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.PACKAGE])
  annotation RequiresApi
  ```

*** ** * ** ***

Denotes that the annotated element should only be called on the given Android API level or higher.

This is similar in purpose to the older `@TargetApi` annotation, but more clearly expresses that this is a requirement on the caller, rather than being used to "suppress" warnings within the method that exceed the `minSdkVersion`.

For API requirements on SDK extensions, see the androidx.annotation.RequiresExtension annotation.

## Summary

| ### Public constructors |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi#RequiresApi(kotlin.Int,kotlin.Int)(value: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 1) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, api: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 1) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` | Cmn android |

| ### Public properties |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi#api()` The API level to require | Cmn android |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi#value()` The API level to require. | Cmn android |

## Public constructors

### RequiresApi

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

```
RequiresApi(value: @IntRange(from = 1) Int = 1, api: @IntRange(from = 1) Int = 1)
```

## Public properties

### api

Cmn android

```
val api: Int
```

The API level to require

### value

Cmn android

```
val value: Int
```

The API level to require. Alias for .api which allows you to leave out the `api=` part.