Android device version
How can i get the current android deveice version (1.5, 1.6, 2.0, etc.) programm开发者_如何学Goatically. i.e I have installed my apk in ANdroid 2.2 device.. I need to get the device version (android emulator version in which my application is currently running )
The integer representing the API level can be found at android.os.Build.VERSION.SDK_INT
So you could do:
int apiLevel = android.os.Build.VERSION.SDK_INT;
The possible values of that integer across all devices can be found in here. If you want to compare versions against a named release of android, use the name of each constant here. You cannot compare the device version against the release numbers like 2.1 , 2.2 etc. so if you want to do that you must use the release name or API level, and then convert manually.
Look at following post might help How can I check in code the Android version like 1.5 or 1.6
精彩评论