In most situations you only have to query whether you have an Android version lower than Android 11 or Android 10. In these cases you can also query it without an (API level) extension:
How to get the Android version (a non-string, but a number) of your device without showing any dots after it (e.g. 8 instead of 8.1 / Oreo or 4 instead of 4.4.x / KitKat):
I checked the MIT sources. This was the source code for the PlatformVersion block.
@SimpleProperty(description = "The dotted version number of the platform, such as 4.2.2 or 10.0. "
+ "This is platform specific and there is no guarantee that it has a particular format.")
public String PlatformVersion() {
return Build.VERSION.RELEASE;
}
If you go to Android Developers, you see:
The user-visible version string. E.g., "1.0" or "3.4b5" or "bananas". This field is an opaque string. Do not assume that its value has any particular structure or that values of RELEASE from different releases can be somehow ordered.