blob: ea56999e06e268ab8eaeabb732a5be62ecb9d512 [file]
<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&amp;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&nbsp;=&nbsp;AnnotationRetention.BINARY)<br>@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.annotation/-target/index.html">Target</a>(allowedTargets&nbsp;=&nbsp;[AnnotationTarget.ANNOTATION_CLASS,&nbsp;AnnotationTarget.CLASS,&nbsp;AnnotationTarget.FUNCTION,&nbsp;AnnotationTarget.PROPERTY_GETTER,&nbsp;AnnotationTarget.PROPERTY_SETTER,&nbsp;AnnotationTarget.CONSTRUCTOR,&nbsp;AnnotationTarget.FIELD,&nbsp;AnnotationTarget.FILE])<br>@<a href="https://developer.android.com/reference/java/lang/annotation/Target.html">Target</a>(value&nbsp;=&nbsp;[ElementType.TYPE,&nbsp;ElementType.METHOD,&nbsp;ElementType.CONSTRUCTOR,&nbsp;ElementType.FIELD,&nbsp;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 &quot;suppress&quot; 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&nbsp;=&nbsp;1) int&nbsp;value,&nbsp;@<a href="/reference/androidx/annotation/IntRange.html">IntRange</a>(from&nbsp;=&nbsp;1) int&nbsp;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&nbsp;<a href="/reference/androidx/annotation/RequiresApi.html#RequiresApi(kotlin.Int,kotlin.Int)">RequiresApi</a>(@<a href="/reference/androidx/annotation/IntRange.html">IntRange</a>(from&nbsp;=&nbsp;1) int&nbsp;value,&nbsp;@<a href="/reference/androidx/annotation/IntRange.html">IntRange</a>(from&nbsp;=&nbsp;1) int&nbsp;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&nbsp;final&nbsp;int&nbsp;<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&nbsp;final&nbsp;int&nbsp;<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>