davidvarghese
davidvarghese

Reputation: 677

How to get the specific OS version in android?

I need to give different functionalities for OS version > 4.4.2 and OS versions <= 4.4.2 .

When I used android.os.Build.VERSION_CODES for that purpose it is giving me the code corresponding to KITKAT for all versions of 4.4,4.4.1,4.4.2,4.4.3 . So how can I specifically differentiate between OS version 4.4.2 and 4.4.3?

Upvotes: 0

Views: 8938

Answers (5)

Skramewell
Skramewell

Reputation: 29

Maybe that'll help you a bit:

int currentapiVersion = android.os.Build.VERSION.SDK_INT;
if (currentapiVersion > 11){
    //your code here
}

More information about API: API's

Upvotes: 0

MSA
MSA

Reputation: 2482

You can use this:

String myVersion = android.os.Build.VERSION.RELEASE; // e.g. myVersion := "1.6"
int sdkVersion = android.os.Build.VERSION.SDK_INT; // e.g. sdkVersion := 8; 

Source: Link

Upvotes: 0

Panther
Panther

Reputation: 9408

Use this.. http://developer.android.com/reference/android/os/Build.VERSION.html

You have String RELEASE which will be useful

Upvotes: 0

Zsombor Erdődy-Nagy
Zsombor Erdődy-Nagy

Reputation: 16914

You could use the Build.VERSION.RELEASE field for this, check this thread for specifics. However, I advise you to use the .VERSION_CODES field wherever possible.

Upvotes: 3

mithrop
mithrop

Reputation: 3353

You can try with android.os.Build.VERSION.RELEASE if it's fit your needs.

Source : http://developer.android.com/reference/android/os/Build.VERSION.html

Upvotes: 0

Related Questions