In the gui you can go to Settings->About Phone->Firmware Version and get 2.1 (or whatever). How do I do it from command line (or for a native application that needs to do it in run time ) ?
so what is this firmware version that I'm seeing in the GUI - I assumed it's the ndk version since numbers matched ("assumptions is the mother all f##kups..."). And do you know where it comes from ?
Dror Cohen
2010-03-14 15:34:46
That's the Android OS version, which you can access in Java via `android.os.Build.VERSION.RELEASE`. You shouldn't need to look at that though; the `minSdkVersion` attribute in the manifest should be enough.
Christopher
2010-03-14 16:43:52
Also when using OpenGL you can specify what version of OpenGL need at least: <uses-feature android:glEsVersion="0x00010001" /> for OpenGL 1.1 for example.
Soulreaper
2010-03-14 16:49:22
@christopher: thanks for the information. How do I get the os version from my native application (at runtime) ?
Dror Cohen
2010-03-14 21:50:43
As far as I'm aware, there is no such function to do so. The NDK is only for writing native libraries, not fully native Android applications. You'll always need a Java (dalvik) application to be running in order to utilise components written using the NDK, therefore any runtime version checks should be enforced via the AndroidManifest.xml file, or via Java code.
Christopher
2010-03-14 22:20:17
A:
Actually, that is a good question. If I want to enable compilations on both versions, I need to know what version of NDK I'm using, because the code tree structure is different between the 2 of them. I found that there is some kind of a variable they are using inside one of their internal makefiles, but it is the same for both versions.
I hope google will add a way to distinguish between the versions in the future.
Ofer
2010-04-26 08:33:29
A:
Since the app can be downloaded to various phones, the app need to get the firmware version at runtime in order to be able to pick different layouts.
Nils Thorell
2010-06-18 07:18:27
this is not really an answer therefor it should be a comment. The app needs to know on which firmware version it is running but there is a difference between the ndk and the sdk. In the sdk you can get the firmware version via the Build class.
Janusz
2010-06-18 11:00:07