Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check Android version in code [duplicate]

Does anyone know how can I check the system version (e.g. 1.0, 2.2, etc.) programatically?

like image 281
davs Avatar asked Jun 22 '10 13:06

davs


People also ask

How do I find my Build number android?

The build number is reported in Settings > About phone. For Android Oreo, it is shown in Settings > System > About phone.

How do I find Android SDK version?

Click Tools > SDK Manager. In the SDK Platforms tab, select Android 11. In the SDK Tools tab, select Android SDK Build-Tools 30 (or higher). Click OK to begin install.


1 Answers

Example how to use it:

if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD) {
     // only for gingerbread and newer versions
}
like image 166
ATom Avatar answered Oct 07 '22 18:10

ATom