tags:

views:

34

answers:

4

How do I get the Api level of the phone curently running my application? I am sure its simple but I can not find it as all my searches bring up tons of junk.

A: 

Check android.os.Build.VERSION.

birryree
Thank you just could not see it ;)
Doodle
A: 

android.os.Build.VERSION.SDK_INT

Here you can find the possible values: VERSION_CODES.

Cristian
A: 

try this :Float.valueOf(android.os.Build.VERSION.RELEASE) <= 2.1

Tsung.W
A: 
Integer.valueOf(android.os.Build.VERSION.SDK);

Values are:

Platform Version   API Level
Android 2.2       8
Android 2.1       7
Android 2.0.1     6
Android 2.0       5
Android 1.6       4
Android 1.5       3
Android 1.1       2
Android 1.0       1

CAUTION: don't use android.os.Build.VERSION.SDK_INT if <uses-sdk android:minSdkVersion="3" />.

You will get exception on all devices with Android 1.5 and lower because Build.VERSION.SDK_INT is since SDK 4 (Donut 1.6).

rude