RequiresApi

annotation 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 {@code @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 {@code minSdkVersion}.

Summary

Public methods

abstract @IntRange(from = "1") @NonNull int
api()

The API level to require

abstract @IntRange(from = "1") @NonNull int

The API level to require.

Public methods

api

@IntRange(from = "1")
@NonNull
public abstract @IntRange(from = "1") int api()

The API level to require

value

@IntRange(from = "1")
@NonNull
public abstract @IntRange(from = "1") int value()

The API level to require. Alias for api which allows you to leave out the {@code * api=} part.