Verify android version kotlin Android 33

659 views Asked by At

I had a problem recently and I couldn't get an easy answer on the internet, I come to share my experience.

I needed to check the android version via code with all the ways I found on the internet were deprecated, here's the way I found current for this simple check

Resolução do problema foi

if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.P){

       true
}
else{

       false
}
1

There are 1 answers

0
Javlon On

You can check if your android version 33 or not by using this function:

fun isAndroid33(): Boolean {
    return Build.VERSION.SDK_INT == Build.VERSION_CODES.TIRAMISU
}