| <html devsite="true"> |
| <head> |
| <title>RequiresApi</title> |
| {% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} |
| {% include "_shared/_reference-head-tags.html" %} |
| </head> |
| <body> |
| <div itemscope="" itemtype="http://developers.google.com/ReferenceObject"> |
| <meta itemprop="name" content="RequiresApi"> |
| <meta itemprop="path" content="androidx.annotation"> |
| <meta itemprop="property" content="getApi()"> |
| <meta itemprop="property" content="getValue()"> |
| <meta itemprop="language" content="JAVA"> |
| </div> |
| <div id="header-block"> |
| <div> |
| <h1>RequiresApi</h1> |
| </div> |
| <div id="metadata-info-block"> |
| <div id="source-link"><a href="https://cs.android.com/search?q=file:androidx/annotation/RequiresApi.kt+class:androidx.annotation.RequiresApi&ss=androidx/platform/frameworks/support" class="external">View Source</a></div> |
| </div> |
| </div> |
| <div id="refdoc-switcher-placeholder"></div> |
| <p> |
| <pre>@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.annotation/-must-be-documented/index.html">MustBeDocumented</a><br>@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.annotation/-retention/index.html">Retention</a>(value = AnnotationRetention.BINARY)<br>@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.annotation/-target/index.html">Target</a>(allowedTargets = [AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FIELD, AnnotationTarget.FILE])<br>@<a href="https://developer.android.com/reference/java/lang/annotation/Target.html">Target</a>(value = [ElementType.TYPE, ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.PACKAGE])<br>public annotation <a href="/reference/androidx/annotation/RequiresApi.html">RequiresApi</a></pre> |
| </p> |
| <hr> |
| <p>Denotes that the annotated element should only be called on the given API level or higher.</p> |
| <p>This is similar in purpose to the older <code>@TargetApi</code> 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 <code>minSdkVersion</code>.</p> |
| <p>For API requirements on SDK extensions, see the <code><a href="/reference/androidx/annotation/RequiresExtension.html">RequiresExtension</a></code> annotation.</p> |
| <h2>Summary</h2> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%"><h3>Public constructors</h3></th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td> |
| <div><code><a href="/reference/androidx/annotation/RequiresApi.html#RequiresApi(kotlin.Int,kotlin.Int)">RequiresApi</a>(@<a href="/reference/androidx/annotation/IntRange.html">IntRange</a>(from = 1) int value, @<a href="/reference/androidx/annotation/IntRange.html">IntRange</a>(from = 1) int api)</code></div> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%"><h3>Public methods</h3></th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code>final int</code></td> |
| <td> |
| <div><code><a href="/reference/androidx/annotation/RequiresApi.html#getApi()">getApi</a>()</code></div> |
| <p>The API level to require</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>final int</code></td> |
| <td> |
| <div><code><a href="/reference/androidx/annotation/RequiresApi.html#getValue()">getValue</a>()</code></div> |
| <p>The API level to require.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="list"> |
| <h2>Public constructors</h2> |
| <div class="api-item"><a name="RequiresApi(kotlin.Int, kotlin.Int)"></a><a name="RequiresApi-kotlin.Int-kotlin.Int-"></a><a name="requiresapi"></a> |
| <div class="api-name-block"> |
| <div> |
| <h3 id="RequiresApi(kotlin.Int,kotlin.Int)">RequiresApi</h3> |
| </div> |
| </div> |
| <pre class="api-signature no-pretty-print">public <a href="/reference/androidx/annotation/RequiresApi.html#RequiresApi(kotlin.Int,kotlin.Int)">RequiresApi</a>(@<a href="/reference/androidx/annotation/IntRange.html">IntRange</a>(from = 1) int value, @<a href="/reference/androidx/annotation/IntRange.html">IntRange</a>(from = 1) int api)</pre> |
| </div> |
| </div> |
| <div class="list"> |
| <h2>Public methods</h2> |
| <div class="api-item"><a name="getApi--"></a><a name="getapi"></a> |
| <div class="api-name-block"> |
| <div> |
| <h3 id="getApi()">getApi</h3> |
| </div> |
| </div> |
| <pre class="api-signature no-pretty-print">public final int <a href="/reference/androidx/annotation/RequiresApi.html#getApi()">getApi</a>()</pre> |
| <p>The API level to require</p> |
| </div> |
| <div class="api-item"><a name="getValue--"></a><a name="getvalue"></a> |
| <div class="api-name-block"> |
| <div> |
| <h3 id="getValue()">getValue</h3> |
| </div> |
| </div> |
| <pre class="api-signature no-pretty-print">public final int <a href="/reference/androidx/annotation/RequiresApi.html#getValue()">getValue</a>()</pre> |
| <p>The API level to require. Alias for .api which allows you to leave out the <code>api=</code> part.</p> |
| </div> |
| </div> |
| </body> |
| </html> |