I need to check in code what Android release version is running currently on target device. Can you supply code example?
What is the latest version of Android? The latest version of Android OS is 12, released in October 2021. Learn more about OS 12, including its key features.
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. In the above code, we have taken text view to show device version number.
I was looking for this and didn't find a solution - ended up here and I figured it out myself so for anyone out there looking for this:
int SDK_INT = android.os.Build.VERSION.SDK_INT;
this returns os sdk level 7 eclair 8 froyo etc
To get the build version of Android like: 2.2, 2.3.3, 4.0 or 4.0.3 ... use the following code:
String deviceVersion = Build.VERSION.RELEASE;
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