# WindowSdkExtensions

Artifact: [androidx.window:window](https://developer.android.com/jetpack/androidx/releases/window) [View Source](https://cs.android.com/search?q=file:androidx/window/WindowSdkExtensions.kt+class:androidx.window.WindowSdkExtensions) Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/window#1.2.0)

*** ** * ** ***


```
public abstract class WindowSdkExtensions
```

<br />

*** ** * ** ***

This class provides information about the extension SDK versions for window features present on this device. Use `https://developer.android.com/reference/androidx/window/WindowSdkExtensions#extensionVersion()` to get the version of the extension. The extension version advances as the platform evolves and new APIs are added, so is suitable to use for determining API availability at runtime.

Window Manager Jetpack APIs that require window SDK extensions support are denoted with `https://developer.android.com/reference/androidx/window/RequiresWindowSdkExtension`. The caller must check whether the device's extension version is greater than or equal to the minimum level reported in `https://developer.android.com/reference/androidx/window/RequiresWindowSdkExtension`.

```kotlin
import androidx.window.WindowSdkExtensions
import androidx.window.embedding.SplitAttributes
import androidx.window.embedding.SplitController
import androidx.window.samples.embedding.context

// For example, SplitController#setSplitAttributesCalculator requires extension version 2.
// Callers must check the current extension version before invoking the API, or exception will
// be thrown.
if (WindowSdkExtensions.getInstance().extensionVersion >= 2) {
    SplitController.getInstance(context).setSplitAttributesCalculator(splitAttributesCalculator)
}
```

## Summary

| ### Public methods |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int` | `https://developer.android.com/reference/androidx/window/WindowSdkExtensions#getExtensionVersion()()` Reports the device's extension version |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/WindowSdkExtensions` | `https://developer.android.com/reference/androidx/window/WindowSdkExtensions#getInstance()()` Returns a `https://developer.android.com/reference/androidx/window/WindowSdkExtensions` instance. |

## Public methods

### getExtensionVersion

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/window#1.2.0)

```
public @IntRange(from = 0) int getExtensionVersion()
```

Reports the device's extension version

When Window SDK Extensions is not present on the device, the extension version will be 0.

### getInstance

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/window#1.2.0)

```
public static final @NonNull WindowSdkExtensions getInstance()
```

Returns a `https://developer.android.com/reference/androidx/window/WindowSdkExtensions` instance.