0

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?

davidvarghese
  • 637
  • 2
  • 10
  • 18

5 Answers5

3

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.

Community
  • 1
  • 1
Zsombor Erdődy-Nagy
  • 16,864
  • 16
  • 76
  • 101
0

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

mithrop
  • 3,283
  • 2
  • 21
  • 40
0

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

You have String RELEASE which will be useful

Panther
  • 8,938
  • 3
  • 23
  • 34
0

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

Community
  • 1
  • 1
MSA
  • 2,502
  • 2
  • 22
  • 35
  • Wtf... show a number incorrect .... example : I have to minSdkVersion 15 and show 19 .... –  Oct 09 '15 at 10:10
0

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

Skramewell
  • 29
  • 5