Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Higher API calls when lower SDK targeted

Tags:

android

My app supports minSdkVersion=10 and targeting 16. I want to call methods specific to API level >= 14 if a specific device supports them. I could check running OS version at runtime and whether call or not higher API methods but when I specify min SDK version, methods that exist only in versions higher than 10 are not visible. Is there any way to use higher API methods than minSdkVersion?

like image 747
Maxim Avatar asked Jul 31 '12 22:07

Maxim


1 Answers

You can test the device's API with this:

if(android.os.Build.VERSION.SDK_INT >= 14) {
    // Do something fancy
}
else {
    // Do something regular
}
like image 161
Sam Avatar answered Oct 23 '22 17:10

Sam