BuildCompat
public static class BuildCompat
This class contains additional platform version checking methods for targeting pre-release versions of Android.
Summary
Nested types |
|---|
@RequiresOptInExperimental feature set for pre-release SDK checks. |
Public fields |
|
|---|---|
static final int |
@ChecksSdkIntAtLeast(extension = 1000000)The value of |
static @NonNull BuildCompat |
|
static final int |
@ChecksSdkIntAtLeast(extension = 30)The value of |
static final int |
@ChecksSdkIntAtLeast(extension = 31)The value of |
static final int |
@ChecksSdkIntAtLeast(extension = 33)The value of |
Public methods |
|
|---|---|
static final boolean |
@ChecksSdkIntAtLeast(api = 36, codename = "Baklava")This method is deprecated. Android Baklava is a finalized release and this method is no longer necessary. |
static final boolean |
@ChecksSdkIntAtLeast(api = 3600001)This method is deprecated. Android Baklava minor release 1 is a finalized release and this method is no longer necessary. |
static final boolean |
@ChecksSdkIntAtLeast(api = 24)This method is deprecated. Android N is a finalized release and this method is no longer necessary. |
static final boolean |
@ChecksSdkIntAtLeast(api = 25)This method is deprecated. Android N MR1 is a finalized release and this method is no longer necessary. |
static final boolean |
@ChecksSdkIntAtLeast(api = 26)This method is deprecated. Android O is a finalized release and this method is no longer necessary. |
static final boolean |
@ChecksSdkIntAtLeast(api = 27)This method is deprecated. Android O MR1 is a finalized release and this method is no longer necessary. |
static final boolean |
@ChecksSdkIntAtLeast(api = 28)This method is deprecated. Android P is a finalized release and this method is no longer necessary. |
static final boolean |
@ChecksSdkIntAtLeast(api = 29)This method is deprecated. Android Q is a finalized release and this method is no longer necessary. |
static final boolean |
@ChecksSdkIntAtLeast(api = 30)This method is deprecated. Android R is a finalized release and this method is no longer necessary. |
static final boolean |
@ChecksSdkIntAtLeast(api = 31, codename = "S")This method is deprecated. Android S is a finalized release and this method is no longer necessary. |
static final boolean |
@ChecksSdkIntAtLeast(api = 32, codename = "Sv2")This method is deprecated. Android Sv2 is a finalized release and this method is no longer necessary. |
static final boolean |
@ChecksSdkIntAtLeast(api = 33, codename = "Tiramisu")This method is deprecated. Android Tiramisu is a finalized release and this method is no longer necessary. |
static final boolean |
@ChecksSdkIntAtLeast(api = 34, codename = "UpsideDownCake")This method is deprecated. Android UpsideDownCase is a finalized release and this method is no longer necessary. |
static final boolean |
@ChecksSdkIntAtLeast(api = 35, codename = "VanillaIceCream")This method is deprecated. Android VanillaIceCream is a finalized release and this method is no longer necessary. |
Public fields
AD_SERVICES_EXTENSION_INT
@ChecksSdkIntAtLeast(extension = 1000000)
public static final int AD_SERVICES_EXTENSION_INT
The value of SdkExtensions.getExtensionVersion(AD_SERVICES). This is a convenience constant which provides the extension version in a similar style to Build.VERSION.SDK_INT.
Compared to calling getExtensionVersion directly, using this constant has the benefit of not having to verify the getExtensionVersion method is available.
| Returns | |
|---|---|
int |
the version of the AdServices extension, if it exists. 0 otherwise. |
R_EXTENSION_INT
@ChecksSdkIntAtLeast(extension = 30)
public static final int R_EXTENSION_INT
The value of SdkExtensions.getExtensionVersion(R). This is a convenience constant which provides the extension version in a similar style to Build.VERSION.SDK_INT.
Compared to calling getExtensionVersion directly, using this constant has the benefit of not having to verify the getExtensionVersion method is available.
| Returns | |
|---|---|
int |
the version of the R extension, if it exists. 0 otherwise. |
S_EXTENSION_INT
@ChecksSdkIntAtLeast(extension = 31)
public static final int S_EXTENSION_INT
The value of SdkExtensions.getExtensionVersion(S). This is a convenience constant which provides the extension version in a similar style to Build.VERSION.SDK_INT.
Compared to calling getExtensionVersion directly, using this constant has the benefit of not having to verify the getExtensionVersion method is available.
| Returns | |
|---|---|
int |
the version of the S extension, if it exists. 0 otherwise. |
T_EXTENSION_INT
@ChecksSdkIntAtLeast(extension = 33)
public static final int T_EXTENSION_INT
The value of SdkExtensions.getExtensionVersion(TIRAMISU). This is a convenience constant which provides the extension version in a similar style to Build.VERSION.SDK_INT.
Compared to calling getExtensionVersion directly, using this constant has the benefit of not having to verify the getExtensionVersion method is available.
| Returns | |
|---|---|
int |
the version of the T extension, if it exists. 0 otherwise. |
Public methods
@ChecksSdkIntAtLeast(api = 36, codename = "Baklava")
public static final booleanisAtLeastB()
Checks if the device is running on a pre-release version of Android Baklava or a release version of Android Baklava or newer.
Note: When Android Baklava is finalized for release, this method will be removed and all calls must be replaced with Build.VERSION.SDK_INT >= 36.
| Returns | |
|---|---|
boolean |
|
@ChecksSdkIntAtLeast(api = 3600001)
public static final booleanisAtLeastB_1()
Checks if the device is running on a release version of Android Baklava minor release 1, or newer.
| Returns | |
|---|---|
boolean |
|
@ChecksSdkIntAtLeast(api = 24)
public static final booleanisAtLeastN()
Checks if the device is running on the Android N release or newer.
| Returns | |
|---|---|
boolean |
|
@ChecksSdkIntAtLeast(api = 25)
public static final booleanisAtLeastNMR1()
Checks if the device is running on the Android N MR1 release or newer.
| Returns | |
|---|---|
boolean |
|
@ChecksSdkIntAtLeast(api = 26)
public static final booleanisAtLeastO()
Checks if the device is running on a release version of Android O or newer.
| Returns | |
|---|---|
boolean |
|
@ChecksSdkIntAtLeast(api = 27)
public static final booleanisAtLeastOMR1()
Checks if the device is running on a release version of Android O MR1 or newer.
| Returns | |
|---|---|
boolean |
|
@ChecksSdkIntAtLeast(api = 28)
public static final booleanisAtLeastP()
Checks if the device is running on a release version of Android P or newer.
| Returns | |
|---|---|
boolean |
|
@ChecksSdkIntAtLeast(api = 29)
public static final booleanisAtLeastQ()
Checks if the device is running on release version of Android Q or newer.
| Returns | |
|---|---|
boolean |
|
@ChecksSdkIntAtLeast(api = 30)
public static final booleanisAtLeastR()
Checks if the device is running on release version of Android R or newer.
| Returns | |
|---|---|
boolean |
|
@ChecksSdkIntAtLeast(api = 31, codename = "S")
public static final booleanisAtLeastS()
Checks if the device is running on a pre-release version of Android S or a release version of Android S or newer.
| Returns | |
|---|---|
boolean |
|
@ChecksSdkIntAtLeast(api = 32, codename = "Sv2")
public static final booleanisAtLeastSv2()
Checks if the device is running on a pre-release version of Android Sv2 or a release version of Android Sv2 or newer.
| Returns | |
|---|---|
boolean |
|
@ChecksSdkIntAtLeast(api = 33, codename = "Tiramisu")
public static final booleanisAtLeastT()
Checks if the device is running on a pre-release version of Android Tiramisu or a release version of Android Tiramisu or newer.
Note: When Android Tiramisu is finalized for release, this method will be removed and all calls must be replaced with Build.VERSION.SDK_INT >= 33.
| Returns | |
|---|---|
boolean |
|
@ChecksSdkIntAtLeast(api = 34, codename = "UpsideDownCake")
public static final booleanisAtLeastU()
Checks if the device is running on a pre-release version of Android UpsideDownCake or a release version of Android UpsideDownCake or newer.
Note: When Android UpsideDownCake is finalized for release, this method will be removed and all calls must be replaced with Build.VERSION.SDK_INT >= 34.
| Returns | |
|---|---|
boolean |
|
@ChecksSdkIntAtLeast(api = 35, codename = "VanillaIceCream")
public static final booleanisAtLeastV()
Checks if the device is running on a pre-release version of Android VanillaIceCream or a release version of Android VanillaIceCream or newer.
Note: When Android VanillaIceCream is finalized for release, this method will be removed and all calls must be replaced with Build.VERSION.SDK_INT >= 35.
| Returns | |
|---|---|
boolean |
|