Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can an android application check the version of the phone

Tags:

android

I would like to write an application that uses live wallpapers for insatnce. this feature is supported only in version 7 and up. Is it posiible, that the application checks the version of the android phone and depending on that runs different code (e.g. uses live wallpaper or static background.)

Do you have a code example for that? Does that require special permissions?

like image 560
Anne Avatar asked Feb 24 '23 22:02

Anne


2 Answers

Assuming you're requiring Android 1.6 or newer:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ECLAIR_MR1) {
    ...
}
like image 66
EboMike Avatar answered May 10 '23 13:05

EboMike


Yes there is. Look at the Build class in Android. You can use it like so Build.VERSION.SDK_INT

like image 28
Amir Raminfar Avatar answered May 10 '23 13:05

Amir Raminfar