Does anyone know how can I check the system version (e.g. 1.0
, 2.2
, etc.) programatically?
This example demonstrates how do I retrieve android API version programmatically. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main. xml.
Build. VERSION. SDK_INT: The SDK version of the software currently running on this hardware device. in other words - this is the Android version of the device running the app.
Android 11 (API level 30)
Example how to use it:
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD) {
// only for gingerbread and newer versions
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With