问题
On iOS, Adobe AIR's Capabilities.os may be something like "iPhone OS 5.1.1 iPad3,1
" - very clearly identifying the OS version as well as the device model. On Android, it looks more like "Linux 2.6.35.7-59465-g42bad32
". Wikipedia lists the following Linux kernels for android versions:
- 2.6.29: 1.6, 2.0, 2.1
- 2.6.32: 2.2x
- 2.6.35: 2.3x
- 2.6.36: 3.x
- 3.0.1: 4.0x
Are these set in stone or will some systems report different Linux versions?
Is there a better way to determine Android OS version using AIR and ActionScript?
For my purposes I need to differentiate 4.0 (Ice Cream Sandwich) from 4.1 (Jelly Bean). I think 4.1 uses Linux kernel 3.1.10 - can anyone confirm?
回答1:
Well, I have another solution. I've found this AS3 class which determines Android's version by grabbing an Android system file named "/system/build.prop".
You can also get additional info such as Model, Brand, SDK Version and CPU
Take a look: https://github.com/funky-monkey/Android-Native-Device-Info
See also this for informations regarding iOS:
- http://forum.starling-framework.org/topic/detect-device-modelperformance
回答2:
I can confirm that detecting the Android version by kernel is not so reliable. I was trying to tell apart 4.0 from previous versions, and while most ICS devices have a 3.x Linux kernel, some upgraded tablets such as the Acer Iconia A500 (which originally ships with Android 3.0 Honeycomb) still have a 2.x Linux kernel after upgrading to Android 4.0 ICS. So I guess the same may happen with devices upgraded to Jelly Bean.
I guess one reliable way to get the Android version would be to create a Native Extension which calls the native Android API to get that info (see: How can I check the system version of Android?).
来源:https://stackoverflow.com/questions/11293236/how-can-i-detect-the-android-os-version-in-adobe-air