Skip to main content
Inspiring
June 26, 2011
Answered

detect which device your on

  • June 26, 2011
  • 1 reply
  • 4403 views

Hi,

what are some of the availible options here?

example:

these will all return identical information for motorola droidX and  motorola droid2

Capabilities.cpuArchitecture;

Capabilities.manufacturer;
Capabilities.os;

Capabilities.screenDPI;

however the screens are much different in phisical size... so i need to detect that at runtime

so... any other methods people use to detect differences at runtime?

thanks!

...oh also to detect iOS v.s android, is this the best option?

if (Capabilities.manufacturer == "Android Linux") {
    //android
} else if (Capabilities.manufacturer == "Adobe iOS") {
    //iOS
}
This topic has been closed for replies.
Correct answer Colin Holgate

If you see this article here:

http://renaun.com/blog/2011/03/air-2-6-capabilities-screendpi-on-devices/

it appears that since AIR 2.6 you could check the dpi and serverString values to deduce what device you're on. I imagine that under AIR 2.7 the list is longer, and you could use the values to recognize iPad 2 and iPhone 4 too.

1 reply

Colin Holgate
Colin HolgateCorrect answer
Inspiring
June 26, 2011

If you see this article here:

http://renaun.com/blog/2011/03/air-2-6-capabilities-screendpi-on-devices/

it appears that since AIR 2.6 you could check the dpi and serverString values to deduce what device you're on. I imagine that under AIR 2.7 the list is longer, and you could use the values to recognize iPad 2 and iPhone 4 too.

boat5Author
Inspiring
June 26, 2011

Thanks Colin!

Its unfortunate that droid2 returns 144dpi when its actually 265, however at this time that's enough to detect which of the 2 im on...

I thought serverString was just a string containing all the same values as if you called them individually, but i was wrong.

thanks!

Colin Holgate
Inspiring
June 26, 2011

That table is telling you that the devices will return the wrong values. You would look at the dpi and server values, and from those you can work out what the real DPI is. The Droid X and Droid 2 now have different values for the server string, so one of those is not 144, and that's enough to tell them apart.