For compatibility issues, isn't there a way to detect if the Android OS my app is being run on is a version older than 3.X?
I used to know that in C++, when you're programming for certain OS, you can use something like this (And yes, I do know my macros are incorrect, but the point is given):#if __WINDOWS__ #elseif __APPLE__ #elseif __LINUX__ #endif
Would it be possible to code something like this for Android?
Those are compile time macros so you'd rather want something similar to getVersionEx on Windows.
http://developer.and...ld.VERSION.html should do the trick.
only annoying part is that the SDK_INT field is only available in newer versions (API versions 4+ (Android 1.6 and up) , and the RELEASE field is a string that may contain non numbers (it can be 4.1b3 for example). (There is also a deprecated SDK field but i wouldn't recommend using that).
If you don't care about 1.5 and down you can just use the value in SDK_INT to see what features you'll have available.