2

I create android app, which is connected with estimote beacons. My project has to use estimote library and this library minimum sdk is set to 18, so minimum sdk of my whole project has to be 18. But I want my application works on minimum sdk 14. Is there any possibility to set my project min sdk to 14 and when sdk is older than 18 to turn off using this library?

SOLUTION

I have to use multiple apk to determine which devices can download version with estimote library and which have to download lower api version. More info: http://developer.android.com/google/play/publishing/multiple-apks.html

DivinaProportio
  • 220
  • 1
  • 3
  • 13

3 Answers3

0

You can do it by using this check:

if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2){
    // turn off that library here
}
DmitryArc
  • 4,757
  • 2
  • 37
  • 42
0

If you cannot stop the library for some reasons then do this.

@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle instantanState) {
    .
    .
    .
    if(Build.VERSION.SDK_INT >= 18){
       // start your library here.
    }
}

Make sure to add @SuppressLint("NewApi") before the function in which it is called or you can turn off android lint error checking for new Api features.

Maverick
  • 961
  • 9
  • 13
0

When you want use your library into your app check the OS version with

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2){
  // use your library here
}

but don't forget to manage previous api:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2){
  // use your library here
}
else {
  //do something else
}
Hugo Mallet
  • 200
  • 7