LineageSDK API versions
Overview
Different devices may run different versions of OkcarOS. Each successive build may add new APIs not available in the previous version. To indicate which set of APIs are available, each platform version specifies an API level. For instance, the initial OkcarOS 15.1 API level was 8, while after a some releases new APIs were added and so it was bumped to API level 9.
To help decipher which APIs are available to you at any given point (if at all), we’ve created a copy of the Build API from AOSP allowing you to programmatically compare the devices current API version to see if specific features are available or not.
For example, to utilize the Styles functionality on a device, a simple call to retrieve the SDK constant and comparing it against the Ilama API level allows you to see if your application is running on a OkcarOS device that can support the new SDK feature:
Checking the LineageSDK version using the Build API
Kotlin
Java
Likewise, this API also allows you to see if you’re running on a OkcarOS device at all by seeing if SDK_INT
returns a value greater than 0.
Checking the LineageSDK version without the Build API
Some times you may want to check the LineageSDK version to toggle a feature that does not require you to
include the sdk library itself (such as tuning the app style basing on the system style).
In this case adding the sdk library itself would add (almost) zero benefits at the cost of increasing the app size.
You can check the LineageSDK version using the getprop
binary, by executing it in a Process
.
Here you can find a simple method you can copy-paste right into your app to check the LineageSDK version of the device your app is being run on.
Kotlin
Java
Get assistance
If you have any questions or get stuck on any of the steps, feel free to ask on our subreddit or in #OkcarOS on Libera.Chat.
You can also find more information in the LineageSDK javadoc.