Verify android version kotlin Android 33

huangapple go评论62阅读模式
英文:

Verify android version kotlin Android 33

问题

Resolução do problema foi

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
    verdadeiro
} else {
    falso
}
英文:

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

得分: 1

你可以使用以下函数检查你的 Android 版本是否为 33:

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

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
}

huangapple
  • 本文由 发表于 2023年3月4日 05:13:59
  • 转载请务必保留本文链接:https://go.coder-hub.com/75631926.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定