java – how to programmatically find out android 5.0 version?

Question:

How to programmatically find out the version of android? I found such a solution in one of the answers

System.getProperty("os.version");

But for some reason 3.4.0-5508620 to me, although I have Android 5.0 … Everything else that is in Google is instructions on how to find out through the usual settings …

Answer:

if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
{
    //тут пятая версия
}

The actual value of type int containing the version of the current device is stored in the android.os.Build.VERSION.SDK_INT environment variable

Scroll to Top