Google is committed to advancing racial equity for Black communities. See how.

BuildCompat

open class BuildCompat
kotlin.Any
   ↳ androidx.core.os.BuildCompat

This class contains additional platform version checking methods for targeting pre-release versions of Android.

Summary

Public methods
open static Boolean

Checks if the device is running on the Android N release or newer.

open static Boolean

Checks if the device is running on the Android N MR1 release or newer.

open static Boolean

Checks if the device is running on a release version of Android O or newer.

open static Boolean

Checks if the device is running on a release version of Android O MR1 or newer.

open static Boolean

Checks if the device is running on a release version of Android P or newer.

open static Boolean

Checks if the device is running on release version of Android Q or newer.

open static Boolean

Checks if the device is running on a pre-release version of Android R or a release version of Android R or newer.

open static Boolean

Checks if the device is running on a pre-release version of Android S or a release version of Android S or newer.

Public methods

isAtLeastN

@ChecksSdkIntAtLeast(24) open static fun isAtLeastN(): Boolean

Deprecated: Android N is a finalized release and this method is no longer necessary. It will be removed in a future release of the Support Library. Instead, use Build.VERSION.SDK_INT >= Build.VERSION_CODES.N.

Checks if the device is running on the Android N release or newer.

Return
Boolean true if N APIs are available for use

isAtLeastNMR1

@ChecksSdkIntAtLeast(25) open static fun isAtLeastNMR1(): Boolean

Deprecated: Android N MR1 is a finalized release and this method is no longer necessary. It will be removed in a future release of the Support Library. Instead, use Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1.

Checks if the device is running on the Android N MR1 release or newer.

Return
Boolean true if N MR1 APIs are available for use

isAtLeastO

@ChecksSdkIntAtLeast(26) open static fun isAtLeastO(): Boolean

Deprecated: Android O is a finalized release and this method is no longer necessary. It will be removed in a future release of the Support Library. Instead use Build.VERSION.SDK_INT >= Build.VERSION_CODES.O.

Checks if the device is running on a release version of Android O or newer.

Return
Boolean true if O APIs are available for use, false otherwise

isAtLeastOMR1

@ChecksSdkIntAtLeast(27) open static fun isAtLeastOMR1(): Boolean

Deprecated: Android O MR1 is a finalized release and this method is no longer necessary. It will be removed in a future release of the Support Library. Instead, use Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1.

Checks if the device is running on a release version of Android O MR1 or newer.

Return
Boolean true if O MR1 APIs are available for use, false otherwise

isAtLeastP

@ChecksSdkIntAtLeast(28) open static fun isAtLeastP(): Boolean

Deprecated: Android P is a finalized release and this method is no longer necessary. It will be removed in a future release of the Support Library. Instead, use Build.VERSION.SDK_INT >= Build.VERSION_CODES.P.

Checks if the device is running on a release version of Android P or newer.

Return
Boolean true if P APIs are available for use, false otherwise

isAtLeastQ

@ChecksSdkIntAtLeast(29) open static fun isAtLeastQ(): Boolean

Deprecated: Android Q is a finalized release and this method is no longer necessary. It will be removed in a future release of the Support Library. Instead, use Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q.

Checks if the device is running on release version of Android Q or newer.

Return
Boolean true if Q APIs are available for use, false otherwise

isAtLeastR

@ChecksSdkIntAtLeast("R") open static fun isAtLeastR(): Boolean

Checks if the device is running on a pre-release version of Android R or a release version of Android R or newer.

Note: When Android R is finalized for release, this method will be deprecated and all calls should be replaced with Build.VERSION.SDK_INT >= Build.VERSION_CODES.R.

Return
Boolean true if R APIs are available for use, false otherwise

isAtLeastS

@ChecksSdkIntAtLeast("S") open static fun isAtLeastS(): Boolean

Checks if the device is running on a pre-release version of Android S or a release version of Android S or newer.

Note: When Android S is finalized for release, this method will be deprecated and all calls should be replaced with Build.VERSION.SDK_INT >= Build.VERSION_CODES.S.

Return
Boolean true if S APIs are available for use, false otherwise