# ApiVersion

Summary:[Methods](https://developer.android.com/reference/android/car/ApiVersion#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/car/ApiVersion#inhmethods)  

# ApiVersion

`
public


abstract
class
ApiVersion
`  
`

extends Object


``


`

|---|----------------------------------------------------------------------------------------------------------------------------------|
| java.lang.Object                                                                                                                    ||
| ↳ | android.car.ApiVersion\<T extends[android.car.ApiVersion](https://developer.android.com/reference/android/car/ApiVersion)\<?\>\> |

|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Known direct subclasses [CarVersion](https://developer.android.com/reference/android/car/CarVersion),[PlatformVersion](https://developer.android.com/reference/android/car/PlatformVersion) |----------------------------------------------------------------------------------------|---------------------------------------------------------| | [CarVersion](https://developer.android.com/reference/android/car/CarVersion)           | Represents the API version of the`Car`SDK.              | | [PlatformVersion](https://developer.android.com/reference/android/car/PlatformVersion) | Represents the API version of the standard Android SDK. | |

<br />

*** ** * ** ***

Abstraction of Android APIs.

This class is used to represent a pair of major / minor API versions: the "major" version represents a "traditional" Android SDK release, while the "minor" is used to indicate incremental releases for that major.

This class is needed because the standard Android SDK API versioning only supports major releases, but`Car`APIs can now (starting on[Android 13](https://developer.android.com/reference/android/os/Build.VERSION_CODES#TIRAMISU)) be updated on minor releases as well.

## Summary

|                                                                                                                                  ### Public methods                                                                                                                                   ||
|------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` final int`     | ` `[getMajorVersion](https://developer.android.com/reference/android/car/ApiVersion#getMajorVersion())`() ` Gets the major version of the API represented by this object.                                                                                           |
| ` final int`     | ` `[getMinorVersion](https://developer.android.com/reference/android/car/ApiVersion#getMinorVersion())`() ` Gets the minor version change of API for the same[getMajorVersion()](https://developer.android.com/reference/android/car/ApiVersion#getMajorVersion()). |
| ` final boolean` | ` `[isAtLeast](https://developer.android.com/reference/android/car/ApiVersion#isAtLeast(T))`(T requiredVersion) ` Checks if this API version meets the required version.                                                                                            |

| ### Inherited methods |
|-----------------------|---|
| From class` java.lang.Object ` |-------------------|-------------------------------| | ` Object`         | ` clone() `                   | | ` boolean`        | ` equals(Object arg0) `       | | ` void`           | ` finalize() `                | | ` final Class<?>` | ` getClass() `                | | ` int`            | ` hashCode() `                | | ` final void`     | ` notify() `                  | | ` final void`     | ` notifyAll() `               | | ` String`         | ` toString() `                | | ` final void`     | ` wait(long arg0, int arg1) ` | | ` final void`     | ` wait(long arg0) `           | | ` final void`     | ` wait() `                    | ||

## Public methods

### getMajorVersion

```
public final int getMajorVersion ()
```

Gets the major version of the API represented by this object.

<br />

|    Returns    ||
|-------|--------|
| `int` | <br /> |

### getMinorVersion

```
public final int getMinorVersion ()
```

Gets the minor version change of API for the same[getMajorVersion()](https://developer.android.com/reference/android/car/ApiVersion#getMajorVersion()).

It will reset to`0`whenever[getMajorVersion()](https://developer.android.com/reference/android/car/ApiVersion#getMajorVersion())is updated and will increase by`1`if car builtin or other car platform part is changed with the same[getMajorVersion()](https://developer.android.com/reference/android/car/ApiVersion#getMajorVersion()).

Client should check this version to use APIs which were added in a minor-only version update.

<br />

|    Returns    ||
|-------|--------|
| `int` | <br /> |

### isAtLeast

```
public final boolean isAtLeast (T requiredVersion)
```

Checks if this API version meets the required version.

<br />

|                               Parameters                               ||
|-------------------|-----------------------------------------------------|
| `requiredVersion` | `T`: required major and minor version number <br /> |

|                                                                                                                                                                                                                                       Returns                                                                                                                                                                                                                                        ||
|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `boolean` | `true`if the[major version](https://developer.android.com/reference/android/car/ApiVersion#getMajorVersion())is newer than the`requiredVersion`'s major or if the[major version](https://developer.android.com/reference/android/car/ApiVersion#getMajorVersion())is the same as`requiredVersion`'s major with the[minor version](https://developer.android.com/reference/android/car/ApiVersion#getMinorVersion())the same or newer than`requiredVersion`'s minor <br /> |

|                                               Throws                                               ||
|----------------------------|------------------------------------------------------------------------|
| `IllegalArgumentException` | if`requiredVersion`is not an instance of the same class as this object |