Sarah Northway
Sarah Northway

Reputation: 1068

How can I detect the Android OS version in Adobe AIR?

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:

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?

Upvotes: 5

Views: 6987

Answers (2)

OMA
OMA

Reputation: 3691

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:

Upvotes: 3

OMA
OMA

Reputation: 3691

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

Upvotes: 0

Related Questions