{% setvar book_path %}/reference/kotlin/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

RequiresApi


Denotes that the annotated element should only be called on the given 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 RequiresExtension annotation.

Summary

Public constructors

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

Public properties

Int

The API level to require

android
Int

The API level to require.

android

Public constructors

RequiresApi

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

Public properties

api

val apiInt

The API level to require

value

val valueInt

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