5

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?

Nikhil
  • 16,194
  • 20
  • 64
  • 81
Sarah Northway
  • 1,029
  • 1
  • 14
  • 24
  • I doubt if those are absolutely set in stone, but I'd say it's probably a safe bet that a majority of users haven't changed it from the time they received it and my guess is even when carriers modify the OS they don't mess with the kernel (just educated guesses though). Another bit of intuition would say they might switch OSes or kernels to keep it compatible with the hardware they've chosen. – shaunhusain Jul 02 '12 at 13:36
  • 2
    Out of curiosity why are you trying to determine if it's 4.0/4.1, that is isn't there a property exposed for the feature you want to access? Adobe says "Do not use Capabilities.os to determine a capability based on the operating system if a more specific capability property exists. Basing a capability on the operating system is a bad idea, since it can lead to problems if an application does not consider all potential target operating systems. Instead, use the property corresponding to the capability for which you are testing. For more information, see the Capabilities class description." – shaunhusain Jul 02 '12 at 13:38
  • There is a bug in AIR 3.3 which makes text disappear only in 4.1. The workaround is ugly so I only want to use it if I have to. I agree that determining capabilities by OS is a bad idea, but if AIR behaves differently in different OSes, I need to be able to determine which is running. – Sarah Northway Jul 11 '12 at 11:27

2 Answers2

3

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:

UBIK LOAD PACK
  • 33,980
  • 5
  • 71
  • 116
OMA
  • 3,442
  • 2
  • 32
  • 39
  • 1
    rafaelfaria recently posted a class to that starling forum topic that is exactly what I wanted. It uses the Funky Monkey build.prop solution for Android and has recent iOS devices too. Thanks! – Sarah Northway Oct 24 '13 at 21:35
0

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?).

Community
  • 1
  • 1
OMA
  • 3,442
  • 2
  • 32
  • 39