sdkcheck

Additional

Language
CSS
Version
0.2.4 (Jan 8, 2016)
Created
Dec 11, 2015
Updated
Jan 8, 2016 (Retired)
Owner
akodiakson
Contributor
akodiakson
1
Activity
Badge
Generate
Download
Source code

Commercial

sdkcheck

What version of Android is your user running?

Replaces checks like:

if(android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
  ...
}

with:

if(Sdk.isAtLeastLollipop()){
  ...
}

Examples:

//com.akodiakson.sdk.simple.Sdk
public void example(){
        if(Sdk.isAtLeastMarshmallow()){
            System.out.println("I'm fluffy");
        } else if(Sdk.isAtLeastLollipop()){
            System.out.println("I'm sticky");
        } else if(Sdk.isAtLeastKitKat()){
            System.out.println("I'm crunchy");
        }
}

Non-static variant (more test-friendly):

//com.akodiakson.sdk.Sdk
public void example(){
        Sdk sdk = new SdkImpl();
        if(sdk.isAtLeastMarshmallow()){
            System.out.println("I'm fluffy");
        } else if(sdk.isAtLeastLollipop()){
            System.out.println("I'm sticky");
        } else if(sdk.isAtLeastKitKat()){
            System.out.println("I'm crunchy");
        }
}

#Download

maven { url "https://jitpack.io" }
compile 'com.github.akodiakson:sdkcheck:0.2.4'