Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I check in code the Android version like 1.5 or 1.6

I need to check in code what Android release version is running currently on target device. Can you supply code example?

like image 831
ilana Avatar asked Jun 10 '10 12:06

ilana


People also ask

Which is the latest Android version?

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.

How can I get Android OS 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. In the above code, we have taken text view to show device version number.


2 Answers

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

like image 151
demonreeper Avatar answered Oct 22 '22 18:10

demonreeper


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;
like image 41
dimwinds Avatar answered Oct 22 '22 19:10

dimwinds