WindowSdkExtensions
abstract class WindowSdkExtensions
This class provides information about the extension SDK versions for window features present on this device. Use 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 RequiresWindowSdkExtension. The caller must check whether the device's extension version is greater than or equal to the minimum level reported in RequiresWindowSdkExtension.
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 companion functions |
|
|---|---|
WindowSdkExtensions |
Returns a |
Public properties |
|
|---|---|
open Int |
Reports the device's extension version |
Public companion functions
getInstance
fun getInstance(): WindowSdkExtensions
Returns a WindowSdkExtensions instance.
Public properties
extensionVersion
open val extensionVersion: Int
Reports the device's extension version
When Window SDK Extensions is not present on the device, the extension version will be 0.